From 4996dca4da2739070dcc2c41c9465787ecaf7795 Mon Sep 17 00:00:00 2001 From: "bdodla@expedia.com" <13788369+EXPEbdodla@users.noreply.github.com> Date: Mon, 22 Apr 2024 10:18:58 -0700 Subject: [PATCH] fix: Support for feature view deletes using Expedia provider (#101) * fix: Support for feature view deletes using Expedia provider --------- Co-authored-by: Bhargav Dodla --- .../feast/expediagroup/provider/expedia.py | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/sdk/python/feast/expediagroup/provider/expedia.py b/sdk/python/feast/expediagroup/provider/expedia.py index dc9fed9d49..e973b64af6 100644 --- a/sdk/python/feast/expediagroup/provider/expedia.py +++ b/sdk/python/feast/expediagroup/provider/expedia.py @@ -1,12 +1,14 @@ import logging -from typing import List, Set +from typing import List, Sequence, Set import pandas as pd +from feast.entity import Entity from feast.feature_view import FeatureView from feast.infra.passthrough_provider import PassthroughProvider from feast.repo_config import RepoConfig from feast.stream_feature_view import StreamFeatureView +from feast.usage import set_usage_attribute logger = logging.getLogger(__name__) @@ -58,3 +60,29 @@ def ingest_df( ) super().ingest_df(feature_view, df.drop(drop_list, axis=1)) + + def update_infra( + self, + project: str, + tables_to_delete: Sequence[FeatureView], + tables_to_keep: Sequence[FeatureView], + entities_to_delete: Sequence[Entity], + entities_to_keep: Sequence[Entity], + partial: bool, + ): + set_usage_attribute("provider", self.__class__.__name__) + + if self.online_store: + if tables_to_delete: + logger.info( + f"Data associated to {[feature_view.name for feature_view in tables_to_delete]} feature views will be deleted from the online store based on ttl defined if the entities are not shared with other feature views" + ) + + if self.batch_engine: + self.batch_engine.update( + project, + tables_to_delete, + tables_to_keep, + entities_to_delete, + entities_to_keep, + )