Skip to content

Commit

Permalink
fix(sqllab): : Do not strip comments when executing SQL statements
Browse files Browse the repository at this point in the history
  • Loading branch information
john-bodley committed Jun 14, 2024
1 parent 31afb62 commit d27b3e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion superset/sqllab/query_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def render(self, execution_context: SqlJsonExecutionContext) -> str:

parsed_query = ParsedQuery(
query_model.sql,
strip_comments=True,
engine=query_model.database.db_engine_spec.engine,
)
rendered_query = sql_template_processor.process_template(
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/sqllab_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,9 @@ def test_sql_json_parameter_error(self):
assert data["status"] == "success"

data = self.run_sql(
"SELECT * FROM birth_names WHERE state = '{{ state }}' -- blabblah {{ extra1 }} {{fake.fn()}}\nLIMIT 10",
"SELECT * FROM birth_names WHERE state = '{{ state }}' -- blabblah {{ extra1 }}\nLIMIT 10",
"3",
template_params=json.dumps({"state": "CA"}),
template_params=json.dumps({"state": "CA", "extra1": "comment"}),
)
assert data["status"] == "success"

Expand Down

0 comments on commit d27b3e8

Please sign in to comment.