From 68ff6fc5416b14728c6b9508fa8a4e54525340cd Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Tue, 24 Sep 2024 23:26:01 -0400 Subject: [PATCH] linted and updated Signed-off-by: Francisco Javier Arceo --- sdk/python/feast/inference.py | 4 +++- sdk/python/feast/on_demand_feature_view.py | 2 +- .../unit/local_feast_tests/test_local_feature_store.py | 4 +++- .../tests/unit/test_on_demand_python_transformation.py | 8 ++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sdk/python/feast/inference.py b/sdk/python/feast/inference.py index e625500e549..96c410c6f2d 100644 --- a/sdk/python/feast/inference.py +++ b/sdk/python/feast/inference.py @@ -13,9 +13,9 @@ from feast.infra.offline_stores.file_source import FileSource from feast.infra.offline_stores.redshift_source import RedshiftSource from feast.infra.offline_stores.snowflake_source import SnowflakeSource +from feast.on_demand_feature_view import OnDemandFeatureView from feast.repo_config import RepoConfig from feast.stream_feature_view import StreamFeatureView -from feast.on_demand_feature_view import OnDemandFeatureView from feast.types import String from feast.value_type import ValueType @@ -257,6 +257,8 @@ def _infer_features_and_entities( if field.name not in [feature.name for feature in fv.features]: fv.features.append(field) + fv.entity_columns = entity_columns + def _infer_on_demand_features_and_entities( fv: OnDemandFeatureView, diff --git a/sdk/python/feast/on_demand_feature_view.py b/sdk/python/feast/on_demand_feature_view.py index 49c871ccd0d..16bdaa676f8 100644 --- a/sdk/python/feast/on_demand_feature_view.py +++ b/sdk/python/feast/on_demand_feature_view.py @@ -3,7 +3,7 @@ import inspect import warnings from types import FunctionType -from typing import Any, Optional, Union, get_type_hints, List +from typing import Any, List, Optional, Union, get_type_hints import dill import pandas as pd diff --git a/sdk/python/tests/unit/local_feast_tests/test_local_feature_store.py b/sdk/python/tests/unit/local_feast_tests/test_local_feature_store.py index e5a0c8ca071..0d48a4aa248 100644 --- a/sdk/python/tests/unit/local_feast_tests/test_local_feature_store.py +++ b/sdk/python/tests/unit/local_feast_tests/test_local_feature_store.py @@ -392,7 +392,9 @@ def test_apply_dummy_entity_and_feature_view_columns(test_feature_store): # Register Feature View test_feature_store.apply([e1, fv_no_entity, fv_with_entity]) - fv_from_online_store = test_feature_store.get_feature_view("my_feature_view_no_entity") + fv_from_online_store = test_feature_store.get_feature_view( + "my_feature_view_no_entity" + ) # Note that after the apply() the feature_view serializes the Dummy Entity ID assert fv_no_entity.entity_columns[0].name == DUMMY_ENTITY_ID diff --git a/sdk/python/tests/unit/test_on_demand_python_transformation.py b/sdk/python/tests/unit/test_on_demand_python_transformation.py index d8532eade51..cf92b6dbcb6 100644 --- a/sdk/python/tests/unit/test_on_demand_python_transformation.py +++ b/sdk/python/tests/unit/test_on_demand_python_transformation.py @@ -380,15 +380,15 @@ def python_view(inputs: dict[str, Any]) -> dict[str, Any]: self.store.apply( [driver, driver_stats_source, driver_stats_fv, python_view] ) - self.store.write_to_online_store( - feature_view_name="driver_hourly_stats", df=driver_df - ) - fv_applied = self.store.get_feature_view("driver_hourly_stats") assert fv_applied.entities == [driver.name] # Note here that after apply() is called, the entity_columns are populated with the join_key assert fv_applied.entity_columns[0].name == driver.join_key + self.store.write_to_online_store( + feature_view_name="driver_hourly_stats", df=driver_df + ) + def test_python_transformation_returning_all_data_types(self): entity_rows = [ {