Skip to content

Commit

Permalink
SNOW-1019480-sql-filter-nonsql-statements: strip comments from stream…
Browse files Browse the repository at this point in the history
…d queries
  • Loading branch information
sfc-gh-mraba committed Jan 31, 2024
1 parent c023e5c commit 3454440
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/snowflake/cli/plugins/sql/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,10 @@ def execute(
elif file:
query = file.read_text()

single_statement = len(list(split_statements(StringIO(query)))) == 1
return single_statement, self._execute_string(query)
statements = tuple(
statement
for statement, _ in split_statements(StringIO(query), remove_comments=True)
)
single_statement = len(statements) == 1

return single_statement, self._execute_string("\n".join(statements))

0 comments on commit 3454440

Please sign in to comment.