GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: Filter empty SQL commands at execute_snowflake_statement call sites by jials · Pull Request #6249 · feast-dev/feast

fix: Filter empty SQL commands at execute_snowflake_statement call sites #6249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
franciscojavierarceo merged 4 commits into feast-dev:master from jials:fix/empty-snowflake-query
Apr 21, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix: Filter empty SQL commands at execute_snowflake_statement call sites #6249

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
4 commits
Select commit Hold shift + click to select a range
0c004cf
fix: Handle empty query in execute_snowflake_statement
jials Apr 9, 2026
4b14cbe
fix: Filter empty SQL commands at call sites instead of silently igno…
jials Apr 10, 2026
dee3734
fix: Add missing semicolons in snowflake_table_deletion.sql
jials Apr 10, 2026
7796a3b
fix: Add missing PROJECTS table drop to snowflake_table_deletion.sql
jials Apr 10, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

4 changes: 2 additions & 2 deletions 4 .secrets.baseline
Show comments
View file
Open in desktop

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

12 changes: 7 additions & 5 deletions 12 sdk/python/feast/infra/registry/snowflake.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ def __init__(
with GetSnowflakeConnection(self.registry_config) as conn:
sql_function_file = f"{os.path.dirname(feast.__file__)}/infra/utils/snowflake/registry/snowflake_table_creation.sql"
with open(sql_function_file, "r") as file:
sql_file = file.read()
sql_cmds = sql_file.split(";")
sql_cmds = [
cmd.strip() for cmd in file.read().split(";") if cmd.strip()
]
for command in sql_cmds:
query = command.replace("REGISTRY_PATH", f"{self.registry_path}")
execute_snowflake_statement(conn, query)
Expand Down Expand Up @@ -224,9 +225,10 @@ def teardown(self):
with GetSnowflakeConnection(self.registry_config) as conn:
sql_function_file = f"{os.path.dirname(feast.__file__)}/infra/utils/snowflake/registry/snowflake_table_deletion.sql"
with open(sql_function_file, "r") as file:
sqlFile = file.read()
sqlCommands = sqlFile.split(";")
for command in sqlCommands:
sql_cmds = [
cmd.strip() for cmd in file.read().split(";") if cmd.strip()
]
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

for command in sql_cmds:
query = command.replace("REGISTRY_PATH", f"{self.registry_path}")
execute_snowflake_statement(conn, query)

Expand Down
6 changes: 4 additions & 2 deletions 6 sdk/python/feast/infra/utils/snowflake/registry/snowflake_table_deletion.sql
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
DROP TABLE IF EXISTS REGISTRY_PATH."PROJECTS";

DROP TABLE IF EXISTS REGISTRY_PATH."DATA_SOURCES";

DROP TABLE IF EXISTS REGISTRY_PATH."ENTITIES";
Expand All @@ -16,6 +18,6 @@ DROP TABLE IF EXISTS REGISTRY_PATH."SAVED_DATASETS";

DROP TABLE IF EXISTS REGISTRY_PATH."STREAM_FEATURE_VIEWS";

DROP TABLE IF EXISTS REGISTRY_PATH."VALIDATION_REFERENCES"
DROP TABLE IF EXISTS REGISTRY_PATH."VALIDATION_REFERENCES";

DROP TABLE IF EXISTS REGISTRY_PATH."PERMISSIONS"
DROP TABLE IF EXISTS REGISTRY_PATH."PERMISSIONS";
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

41 changes: 40 additions & 1 deletion 41 sdk/python/tests/unit/infra/utils/snowflake/test_snowflake_utils.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import tempfile
from typing import Optional
from unittest.mock import MagicMock

import pytest
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa

from feast.infra.utils.snowflake.snowflake_utils import parse_private_key_path
from feast.infra.utils.snowflake.snowflake_utils import (
execute_snowflake_statement,
parse_private_key_path,
)

PRIVATE_KEY_PASSPHRASE = "test"

Expand Down Expand Up @@ -69,3 +73,38 @@ def test_parse_private_key_path_key_path_encrypted(encrypted_private_key):
f.name,
None,
)


class TestExecuteSnowflakeStatement:
def test_empty_query_is_passed_through_to_execute(self):
mock_conn = MagicMock()
mock_cursor = MagicMock()
mock_executed_cursor = MagicMock()
mock_conn.cursor.return_value = mock_cursor
mock_cursor.execute.return_value = mock_executed_cursor

result = execute_snowflake_statement(mock_conn, "")

assert result is mock_executed_cursor
mock_cursor.execute.assert_called_once_with("")

def test_valid_query_executes_and_returns_cursor(self):
mock_conn = MagicMock()
mock_cursor = MagicMock()
mock_executed_cursor = MagicMock()
mock_conn.cursor.return_value = mock_cursor
mock_cursor.execute.return_value = mock_executed_cursor

result = execute_snowflake_statement(mock_conn, "SELECT 1")

assert result is mock_executed_cursor
mock_cursor.execute.assert_called_once_with("SELECT 1")

def test_valid_query_raises_on_none_cursor(self):
mock_conn = MagicMock()
mock_cursor = MagicMock()
mock_conn.cursor.return_value = mock_cursor
mock_cursor.execute.return_value = None

with pytest.raises(Exception, match="Snowflake query failed"):
execute_snowflake_statement(mock_conn, "SELECT 1")
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.