Skip to content

Commit c39116d

Browse files
author
easonysliu
committed
fix: scope data source operations by project in shared registry
apply_data_source and delete_data_source match by name only, without filtering by project. When multiple projects share the same registry and have data sources with the same name, this causes cross-project overwrites. Add the project filter to both methods, consistent with how apply_entity, apply_feature_service, and apply_feature_view already scope their lookups by both name and project. Fixes feast-dev#6206
1 parent 3a0a814 commit c39116d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎sdk/python/feast/infra/registry/registry.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,10 @@ def apply_data_source(
394394
registry = self._prepare_registry_for_changes(project)
395395

396396
for idx, existing_data_source_proto in enumerate(registry.data_sources):
397-
if existing_data_source_proto.name == data_source.name:
397+
if (
398+
existing_data_source_proto.name == data_source.name
399+
and existing_data_source_proto.project == project
400+
):
398401
existing_data_source = DataSource.from_proto(existing_data_source_proto)
399402
# Check if the data source has actually changed
400403
if existing_data_source == data_source:
@@ -423,7 +426,7 @@ def delete_data_source(self, name: str, project: str, commit: bool = True):
423426
for idx, data_source_proto in enumerate(
424427
self.cached_registry_proto.data_sources
425428
):
426-
if data_source_proto.name == name:
429+
if data_source_proto.name == name and data_source_proto.project == project:
427430
del self.cached_registry_proto.data_sources[idx]
428431
if commit:
429432
self.commit()

0 commit comments

Comments
 (0)