Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions sdk/python/feast/infra/materialization/snowflake_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,16 @@ def update(
stage_context = f'"{self.repo_config.batch_engine.database}"."{self.repo_config.batch_engine.schema_}"'
stage_path = f'{stage_context}."feast_{project}"'
with GetSnowflakeConnection(self.repo_config.batch_engine) as conn:
query = f"SHOW STAGES IN {stage_context}"
query = f"SHOW USER FUNCTIONS LIKE 'FEAST_{project.upper()}%' IN SCHEMA {stage_context}"
cursor = execute_snowflake_statement(conn, query)
stage_list = pd.DataFrame(
function_list = pd.DataFrame(
cursor.fetchall(),
columns=[column.name for column in cursor.description],
)

# if the stage already exists,
# if the SHOW FUNCTIONS query returns results,
# assumes that the materialization functions have been deployed
if f"feast_{project}" in stage_list["name"].tolist():
if len(function_list.index) > 0:
click.echo(
f"Materialization functions for {Style.BRIGHT + Fore.GREEN}{project}{Style.RESET_ALL} already detected."
)
Expand All @@ -149,7 +149,7 @@ def update(
)
click.echo()

query = f"CREATE STAGE {stage_path}"
query = f"CREATE STAGE IF NOT EXISTS {stage_path}"
execute_snowflake_statement(conn, query)

copy_path, zip_path = package_snowpark_zip(project)
Expand Down