Skip to content

Commit f0594e1

Browse files
fix: Updated snowflake template (#3130)
Signed-off-by: Miles Adkins <[email protected]> Signed-off-by: Miles Adkins <[email protected]>
1 parent 5da89f5 commit f0594e1

File tree

8 files changed

+38
-128
lines changed

8 files changed

+38
-128
lines changed

sdk/python/feast/templates/snowflake/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
A quick view of what's in this repository:
33

44
* `data/` contains raw demo parquet data
5-
* `example_repo.py` contains demo feature definitions
5+
* `driver_repo.py` contains demo feature definitions
66
* `feature_store.yaml` contains a demo setup configuring where data sources are
77
* `test_workflow.py` showcases how to run all key Feast commands, including defining, retrieving, and pushing features.
88

@@ -14,6 +14,6 @@ You can run the overall workflow with `python test_workflow.py`.
1414
2. Setup CI/CD + dev vs staging vs prod environments to automatically update the registry as you change Feast feature definitions. See [docs](https://docs.feast.dev/how-to-guides/running-feast-in-production#1.-automatically-deploying-changes-to-your-feature-definitions).
1515
3. (optional) Regularly scheduled materialization to power low latency feature retrieval (e.g. via Airflow). See [Batch data ingestion](https://docs.feast.dev/getting-started/concepts/data-ingestion#batch-data-ingestion)
1616
for more details.
17-
4. (optional) Deploy feature server instances with `feast serve` to expose endpoints to retrieve online features.
18-
- See [Python feature server](https://docs.feast.dev/reference/feature-servers/python-feature-server) for details.
19-
- Use cases can also directly call the Feast client to fetch features as per [Feature retrieval](https://docs.feast.dev/getting-started/concepts/feature-retrieval)
17+
4. (optional) Deploy feature server instances with `feast serve` to expose endpoints to retrieve online features.
18+
- See [Python feature server](https://docs.feast.dev/reference/feature-servers/python-feature-server) for details.
19+
- Use cases can also directly call the Feast client to fetch features as per [Feature retrieval](https://docs.feast.dev/getting-started/concepts/feature-retrieval)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ def bootstrap():
7575
execute_snowflake_statement(
7676
conn, f'DROP TABLE IF EXISTS "{project_name}_feast_driver_hourly_stats"'
7777
)
78+
execute_snowflake_statement(
79+
conn,
80+
f'ALTER WAREHOUSE IF EXISTS "{snowflake_warehouse}" RESUME IF SUSPENDED',
81+
)
82+
7883
write_pandas(
7984
conn,
8085
driver_df,

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

Lines changed: 0 additions & 58 deletions
This file was deleted.

sdk/python/feast/templates/snowflake/feature_repo/__init__.py

Whitespace-only changes.
Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,28 @@
11
project: my_project
2-
# By default, the registry is a file (but can be turned into a more scalable SQL-backed registry)
3-
# On GCP/AWS, minimally you should create a GCS/S3 bucket for a remote file registry
4-
# See https://docs.feast.dev/getting-started/concepts/registry for details
5-
registry: data/registry.db
6-
provider: gcp
2+
registry: registry.db
3+
provider: local
74
offline_store:
8-
type: snowflake.offline
9-
account: SNOWFLAKE_DEPLOYMENT_URL
10-
user: SNOWFLAKE_USER
11-
password: SNOWFLAKE_PASSWORD
12-
role: SNOWFLAKE_ROLE
13-
warehouse: SNOWFLAKE_WAREHOUSE
14-
database: SNOWFLAKE_DATABASE
5+
type: snowflake.offline
6+
account: SNOWFLAKE_DEPLOYMENT_URL
7+
user: SNOWFLAKE_USER
8+
password: SNOWFLAKE_PASSWORD
9+
role: SNOWFLAKE_ROLE
10+
warehouse: SNOWFLAKE_WAREHOUSE
11+
database: SNOWFLAKE_DATABASE
12+
batch_engine:
13+
type: snowflake.engine
14+
account: SNOWFLAKE_DEPLOYMENT_URL
15+
user: SNOWFLAKE_USER
16+
password: SNOWFLAKE_PASSWORD
17+
role: SNOWFLAKE_ROLE
18+
warehouse: SNOWFLAKE_WAREHOUSE
19+
database: SNOWFLAKE_DATABASE
1520
online_store:
16-
type: snowflake.online
17-
account: SNOWFLAKE_DEPLOYMENT_URL
18-
user: SNOWFLAKE_USER
19-
password: SNOWFLAKE_PASSWORD
20-
role: SNOWFLAKE_ROLE
21-
warehouse: SNOWFLAKE_WAREHOUSE
22-
database: SNOWFLAKE_DATABASE
23-
# Use GCP Datastore
24-
# See https://docs.feast.dev/reference/online-stores/datastore
25-
#online_store:
26-
# type: datastore
27-
# project_id: my_gcp_project
28-
# namespace: my_datastore_namespace
29-
# Use AWS DynamoDB
30-
# See https://docs.feast.dev/reference/online-stores/dynamodb
31-
#online_store:
32-
# type: dynamodb
33-
# region: %AWS_REGION%
34-
# Use Redis
35-
# See https://docs.feast.dev/reference/online-stores/redis
36-
#online_store:
37-
# type: redis
38-
# connection_string: "localhost:6379"
21+
type: snowflake.online
22+
account: SNOWFLAKE_DEPLOYMENT_URL
23+
user: SNOWFLAKE_USER
24+
password: SNOWFLAKE_PASSWORD
25+
role: SNOWFLAKE_ROLE
26+
warehouse: SNOWFLAKE_WAREHOUSE
27+
database: SNOWFLAKE_DATABASE
3928
entity_key_serialization_version: 2

sdk/python/feast/templates/snowflake/feature_store.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

sdk/python/feast/templates/snowflake/feature_repo/test_workflow.py renamed to sdk/python/feast/templates/snowflake/test_workflow.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99

1010
def run_demo():
11-
store = FeatureStore(repo_path=".")
11+
store = FeatureStore(repo_path="./feature_repo")
1212
print("\n--- Run feast apply to setup feature store on Snowflake ---")
13-
subprocess.run(["feast", "apply"])
13+
command = "cd feature_repo; feast apply"
14+
subprocess.run(command, shell=True)
1415

1516
print("\n--- Historical features for training ---")
1617
fetch_historical_features_entity_df(store, for_batch_scoring=False)
@@ -49,7 +50,8 @@ def run_demo():
4950
fetch_online_features(store, use_feature_service=True)
5051

5152
print("\n--- Run feast teardown ---")
52-
subprocess.run(["feast", "teardown"])
53+
command = "cd feature_repo; feast teardown"
54+
subprocess.run(command, shell=True)
5355

5456

5557
def fetch_historical_features_entity_df(store: FeatureStore, for_batch_scoring: bool):

0 commit comments

Comments
 (0)