rusackas commented on code in PR #41127:
URL: https://github.com/apache/superset/pull/41127#discussion_r3615138517


##########
superset/sql_lab.py:
##########
@@ -528,8 +526,15 @@ def execute_sql_statements(  # noqa: C901
             query.set_extra_json_key("progress", msg)
             db.session.commit()
 
-            # Hook to allow environment-specific mutation (usually comments) 
to the SQL
-            query.executed_sql = database.mutate_sql_based_on_config(block)
+            # Hook to allow environment-specific mutation (usually comments) 
to the SQL.
+            # `is_split` reflects whether this block is an individual 
statement: when
+            # the engine runs everything as one block the SQL is not split, 
otherwise
+            # each block is a single split-out statement. This lets 
`MUTATE_AFTER_SPLIT`
+            # decide correctly whether the mutator fires here.
+            query.executed_sql = database.mutate_sql_based_on_config(
+                block,
+                is_split=not db_engine_spec.run_multiple_statements_as_one,

Review Comment:
   Good catch, fixed! Added a guard in `execute_sql_with_cursor` so a mutator 
that strips one statement to nothing raises `INVALID_SQL_ERROR` instead of 
sending an empty query to the engine.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to