FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: SQLite online store deletes tables from other projects in shared registry scenarios by aniketpalu · Pull Request #5766 · feast-dev/feast · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
19 changes: 17 additions & 2 deletions sdk/python/feast/diff/infra_diff.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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,9 @@ 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 +116,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
8 changes: 4 additions & 4 deletions sdk/python/feast/feature_store.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
from feast.online_response import OnlineResponse
from feast.permissions.permission import Permission
from feast.project import Project
from feast.protos.feast.core.InfraObject_pb2 import Infra as InfraProto
from feast.protos.feast.serving.ServingService_pb2 import (
FieldStatus,
GetOnlineFeaturesResponse,
Expand Down Expand Up @@ -792,12 +791,13 @@ 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

Back | FazBrowse Home | New Git URL