Skip to content

Commit 7da0580

Browse files
fix: Remove snowflake source warehouse tech debt (feast-dev#3422)
Signed-off-by: Miles Adkins <miles.adkins@snowflake.com>
1 parent b27472f commit 7da0580

5 files changed

Lines changed: 12 additions & 26 deletions

File tree

protos/feast/core/DataSource.proto

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ message DataSource {
197197

198198
// Defines options for DataSource that sources features from a Snowflake Query
199199
message SnowflakeOptions {
200+
reserved 5; // Snowflake warehouse name
201+
200202
// Snowflake table name
201203
string table = 1;
202204

@@ -209,9 +211,6 @@ message DataSource {
209211

210212
// Snowflake schema name
211213
string database = 4;
212-
213-
// Snowflake warehouse name
214-
string warehouse = 5;
215214
}
216215

217216
// Defines options for DataSource that sources features from a spark table/query

sdk/python/feast/infra/offline_stores/snowflake.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def pull_latest_from_table_or_query(
164164
)
165165
select_timestamps = list(
166166
map(
167-
lambda field_name: f"to_varchar({field_name}, 'YYYY-MM-DD\"T\"HH24:MI:SS.FFTZH:TZM') as {field_name}",
167+
lambda field_name: f"TO_VARCHAR({field_name}, 'YYYY-MM-DD\"T\"HH24:MI:SS.FFTZH:TZM') AS {field_name}",
168168
timestamp_columns,
169169
)
170170
)
@@ -178,9 +178,6 @@ def pull_latest_from_table_or_query(
178178
)
179179
inner_field_string = ", ".join(select_fields)
180180

181-
if data_source.snowflake_options.warehouse:
182-
config.offline_store.warehouse = data_source.snowflake_options.warehouse
183-
184181
with GetSnowflakeConnection(config.offline_store) as conn:
185182
snowflake_conn = conn
186183

@@ -232,9 +229,6 @@ def pull_all_from_table_or_query(
232229
+ '"'
233230
)
234231

235-
if data_source.snowflake_options.warehouse:
236-
config.offline_store.warehouse = data_source.snowflake_options.warehouse
237-
238232
with GetSnowflakeConnection(config.offline_store) as conn:
239233
snowflake_conn = conn
240234

sdk/python/feast/infra/offline_stores/snowflake_source.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from typing import Callable, Dict, Iterable, Optional, Tuple
23

34
from typeguard import typechecked
@@ -45,7 +46,6 @@ def __init__(
4546
timestamp_field (optional): Event timestamp field used for point in time
4647
joins of feature values.
4748
database (optional): Snowflake database where the features are stored.
48-
warehouse (optional): Snowflake warehouse where the database is stored.
4949
schema (optional): Snowflake schema in which the table is located.
5050
table (optional): Snowflake table where the features are stored. Exactly one of 'table'
5151
and 'query' must be specified.
@@ -60,6 +60,14 @@ def __init__(
6060
owner (optional): The owner of the snowflake source, typically the email of the primary
6161
maintainer.
6262
"""
63+
64+
if warehouse:
65+
warnings.warn(
66+
"Specifying a warehouse within a SnowflakeSource is to be deprecated."
67+
"Starting v0.32.0, the warehouse as part of the Snowflake store config will be used.",
68+
RuntimeWarning,
69+
)
70+
6371
if table is None and query is None:
6472
raise ValueError('No "table" or "query" argument provided.')
6573
if table and query:
@@ -73,7 +81,6 @@ def __init__(
7381
schema=_schema,
7482
table=table,
7583
query=query,
76-
warehouse=warehouse,
7784
)
7885

7986
# If no name, use the table as the default name.
@@ -109,7 +116,6 @@ def from_proto(data_source: DataSourceProto):
109116
database=data_source.snowflake_options.database,
110117
schema=data_source.snowflake_options.schema,
111118
table=data_source.snowflake_options.table,
112-
warehouse=data_source.snowflake_options.warehouse,
113119
created_timestamp_column=data_source.created_timestamp_column,
114120
field_mapping=dict(data_source.field_mapping),
115121
query=data_source.snowflake_options.query,
@@ -134,7 +140,6 @@ def __eq__(self, other):
134140
and self.schema == other.schema
135141
and self.table == other.table
136142
and self.query == other.query
137-
and self.warehouse == other.warehouse
138143
)
139144

140145
@property
@@ -157,11 +162,6 @@ def query(self):
157162
"""Returns the snowflake options of this snowflake source."""
158163
return self.snowflake_options.query
159164

160-
@property
161-
def warehouse(self):
162-
"""Returns the warehouse of this snowflake source."""
163-
return self.snowflake_options.warehouse
164-
165165
def to_proto(self) -> DataSourceProto:
166166
"""
167167
Converts a SnowflakeSource object to its protobuf representation.
@@ -335,13 +335,11 @@ def __init__(
335335
schema: Optional[str],
336336
table: Optional[str],
337337
query: Optional[str],
338-
warehouse: Optional[str],
339338
):
340339
self.database = database or ""
341340
self.schema = schema or ""
342341
self.table = table or ""
343342
self.query = query or ""
344-
self.warehouse = warehouse or ""
345343

346344
@classmethod
347345
def from_proto(cls, snowflake_options_proto: DataSourceProto.SnowflakeOptions):
@@ -359,7 +357,6 @@ def from_proto(cls, snowflake_options_proto: DataSourceProto.SnowflakeOptions):
359357
schema=snowflake_options_proto.schema,
360358
table=snowflake_options_proto.table,
361359
query=snowflake_options_proto.query,
362-
warehouse=snowflake_options_proto.warehouse,
363360
)
364361

365362
return snowflake_options
@@ -376,7 +373,6 @@ def to_proto(self) -> DataSourceProto.SnowflakeOptions:
376373
schema=self.schema,
377374
table=self.table,
378375
query=self.query,
379-
warehouse=self.warehouse,
380376
)
381377

382378
return snowflake_options_proto
@@ -393,7 +389,6 @@ def __init__(self, table_ref: str):
393389
schema=None,
394390
table=table_ref,
395391
query=None,
396-
warehouse=None,
397392
)
398393

399394
@staticmethod

sdk/python/tests/integration/feature_repos/universal/data_sources/snowflake.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def create_data_source(
6666
timestamp_field=timestamp_field,
6767
created_timestamp_column=created_timestamp_column,
6868
field_mapping=field_mapping or {"ts_1": "ts"},
69-
warehouse=self.offline_store_config.warehouse,
7069
)
7170

7271
def create_saved_dataset_destination(self) -> SavedDatasetSnowflakeStorage:

sdk/python/tests/unit/test_data_sources.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def test_proto_conversion():
118118
snowflake_source = SnowflakeSource(
119119
name="test_source",
120120
database="test_database",
121-
warehouse="test_warehouse",
122121
schema="test_schema",
123122
table="test_table",
124123
timestamp_field="event_timestamp",

0 commit comments

Comments
 (0)