Skip to content

Commit 1590d6b

Browse files
fix: Changing Snowflake template code to avoid query not implemented … (#3319)
fix: Changing Snowflake template code to avoid query not implemented error Signed-off-by: miles.adkins <miles.adkins@snowflake.com> Signed-off-by: miles.adkins <miles.adkins@snowflake.com>
1 parent 0ad0ace commit 1590d6b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sdk/python/feast/templates/snowflake/test_workflow.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from datetime import datetime, timedelta
44

55
import pandas as pd
6+
import yaml
67
from pytz import utc
78

89
from feast import FeatureStore
@@ -76,6 +77,10 @@ def fetch_historical_features_entity_sql(store: FeatureStore, for_batch_scoring)
7677
datetime.now().replace(microsecond=0, second=0, minute=0).astimezone(tz=utc)
7778
)
7879
start_date = (end_date - timedelta(days=60)).astimezone(tz=utc)
80+
81+
project_name = yaml.safe_load(open("feature_repo/feature_store.yaml"))["project"]
82+
table_name = f"{project_name}_feast_driver_hourly_stats"
83+
7984
# For batch scoring, we want the latest timestamps
8085
if for_batch_scoring:
8186
print(
@@ -86,7 +91,7 @@ def fetch_historical_features_entity_sql(store: FeatureStore, for_batch_scoring)
8691
SELECT
8792
"driver_id",
8893
CURRENT_TIMESTAMP() as "event_timestamp"
89-
FROM {store.list_data_sources()[-1].get_table_query_string()}
94+
FROM {store.get_data_source(table_name).get_table_query_string()}
9095
WHERE "event_timestamp" BETWEEN '{start_date}' AND '{end_date}'
9196
GROUP BY "driver_id"
9297
"""
@@ -97,7 +102,7 @@ def fetch_historical_features_entity_sql(store: FeatureStore, for_batch_scoring)
97102
SELECT
98103
"driver_id",
99104
"event_timestamp"
100-
FROM {store.list_data_sources()[-1].get_table_query_string()}
105+
FROM {store.get_data_source(table_name).get_table_query_string()}
101106
WHERE "event_timestamp" BETWEEN '{start_date}' AND '{end_date}'
102107
"""
103108

0 commit comments

Comments
 (0)