From 1590d6be14b9a9cea6fbde60f2373cb3cd68acb9 Mon Sep 17 00:00:00 2001 From: sfc-gh-madkins <82121043+sfc-gh-madkins@users.noreply.github.com> Date: Fri, 28 Oct 2022 12:04:39 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20Changing=20Snowflake=20template=20code?= =?UTF-8?q?=20to=20avoid=20query=20not=20implemented=20=E2=80=A6=20(#3319)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: Changing Snowflake template code to avoid query not implemented error Signed-off-by: miles.adkins Signed-off-by: miles.adkins --- sdk/python/feast/templates/snowflake/test_workflow.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sdk/python/feast/templates/snowflake/test_workflow.py b/sdk/python/feast/templates/snowflake/test_workflow.py index 904d1e1f3e..b121f22980 100644 --- a/sdk/python/feast/templates/snowflake/test_workflow.py +++ b/sdk/python/feast/templates/snowflake/test_workflow.py @@ -3,6 +3,7 @@ from datetime import datetime, timedelta import pandas as pd +import yaml from pytz import utc from feast import FeatureStore @@ -76,6 +77,10 @@ def fetch_historical_features_entity_sql(store: FeatureStore, for_batch_scoring) datetime.now().replace(microsecond=0, second=0, minute=0).astimezone(tz=utc) ) start_date = (end_date - timedelta(days=60)).astimezone(tz=utc) + + project_name = yaml.safe_load(open("feature_repo/feature_store.yaml"))["project"] + table_name = f"{project_name}_feast_driver_hourly_stats" + # For batch scoring, we want the latest timestamps if for_batch_scoring: print( @@ -86,7 +91,7 @@ def fetch_historical_features_entity_sql(store: FeatureStore, for_batch_scoring) SELECT "driver_id", CURRENT_TIMESTAMP() as "event_timestamp" - FROM {store.list_data_sources()[-1].get_table_query_string()} + FROM {store.get_data_source(table_name).get_table_query_string()} WHERE "event_timestamp" BETWEEN '{start_date}' AND '{end_date}' GROUP BY "driver_id" """ @@ -97,7 +102,7 @@ def fetch_historical_features_entity_sql(store: FeatureStore, for_batch_scoring) SELECT "driver_id", "event_timestamp" - FROM {store.list_data_sources()[-1].get_table_query_string()} + FROM {store.get_data_source(table_name).get_table_query_string()} WHERE "event_timestamp" BETWEEN '{start_date}' AND '{end_date}' """