Skip to content

Commit

Permalink
fix: Make sure schema is used when generating from_expression for S…
Browse files Browse the repository at this point in the history
…nowflake (#4177)

Fix from_expression when using Snowflake offline store

Signed-off-by: TomSteenbergen <[email protected]>
  • Loading branch information
TomSteenbergen authored May 7, 2024
1 parent ba9f4ef commit 5051da7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sdk/python/feast/infra/offline_stores/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ def pull_latest_from_table_or_query(
assert isinstance(data_source, SnowflakeSource)

from_expression = data_source.get_table_query_string()
if not data_source.database and data_source.table:
if not data_source.database and not data_source.schema and data_source.table:
from_expression = f'"{config.offline_store.database}"."{config.offline_store.schema_}".{from_expression}'
if not data_source.database and data_source.schema and data_source.table:
from_expression = f'"{config.offline_store.database}".{from_expression}'

if join_key_columns:
partition_by_join_key_string = '"' + '", "'.join(join_key_columns) + '"'
Expand Down Expand Up @@ -226,8 +228,10 @@ def pull_all_from_table_or_query(
assert isinstance(data_source, SnowflakeSource)

from_expression = data_source.get_table_query_string()
if not data_source.database and data_source.table:
if not data_source.database and not data_source.schema and data_source.table:
from_expression = f'"{config.offline_store.database}"."{config.offline_store.schema_}".{from_expression}'
if not data_source.database and data_source.schema and data_source.table:
from_expression = f'"{config.offline_store.database}".{from_expression}'

field_string = (
'"'
Expand Down

0 comments on commit 5051da7

Please sign in to comment.