Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added project prefix filtering when getting infra difference
Signed-off-by: Aniket Paluskar <apaluska@redhat.com>
  • Loading branch information
aniketpalu committed Dec 8, 2025
commit 271c4efba656ae7b8e867444e30f7dc6ec7a54d9
17 changes: 15 additions & 2 deletions sdk/python/feast/diff/infra_diff.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from typing import Generic, Iterable, List, Tuple, TypeVar
from typing import Generic, Iterable, List, Optional, Tuple, TypeVar

from feast.diff.property_diff import PropertyDiff, TransitionType
from feast.infra.infra_object import (
Expand Down Expand Up @@ -98,7 +98,7 @@ def tag_infra_proto_objects_for_keep_delete_add(


def diff_infra_protos(
current_infra_proto: InfraProto, new_infra_proto: InfraProto
current_infra_proto: InfraProto, new_infra_proto: InfraProto, project: Optional[str] = None
) -> InfraDiff:
infra_diff = InfraDiff()

Expand All @@ -114,6 +114,19 @@ def diff_infra_protos(
new_infra_objects = get_infra_object_protos_by_type(
new_infra_proto, infra_object_class_type
)

# Filter infra objects by project prefix when using shared online stores
# Table names include project prefix: {project}_{table_name}
if project:
project_prefix = f"{project}_"
current_infra_objects = [
obj for obj in current_infra_objects
if obj.name.startswith(project_prefix)
]
new_infra_objects = [
obj for obj in new_infra_objects
if obj.name.startswith(project_prefix)
]
(
infra_objects_to_keep,
infra_objects_to_delete,
Expand Down
5 changes: 2 additions & 3 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,12 +792,11 @@ def plan(
# Compute the desired difference between the current infra, as stored in the registry,
# and the desired infra.
self._registry.refresh(project=self.project)
current_infra_proto = InfraProto()
current_infra_proto.CopyFrom(self._registry.proto().infra)
current_infra_proto = self._registry.get_infra(self.project).to_proto()
desired_registry_proto = desired_repo_contents.to_registry_proto()
new_infra = self._provider.plan_infra(self.config, desired_registry_proto)
new_infra_proto = new_infra.to_proto()
infra_diff = diff_infra_protos(current_infra_proto, new_infra_proto)
infra_diff = diff_infra_protos(current_infra_proto, new_infra_proto, project=self.project)

return registry_diff, infra_diff, new_infra

Expand Down
Loading