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


##########
superset/commands/streaming_export/base.py:
##########
@@ -223,13 +223,27 @@ def _execute_query_and_stream(
             # Merge database to prevent DetachedInstanceError
             merged_database = session.merge(database)
 
+            # `is_split=True` mirrors the non-streaming download path exactly:
+            # Database.get_df() -> _execute_sql_with_mutation_and_logging()
+            # always calls mutate_sql_based_on_config(..., is_split=True) on
+            # SQL Lab's stored select_sql/executed_sql, and the chart query
+            # path applies its own mutation upstream (in
+            # get_query_str_extended, with is_split=False) before landing
+            # here. Since `is_split` and `MUTATE_AFTER_SPLIT` are compared
+            # for equality, `is_split=True` is the complement of that
+            # upstream chart mutation -- together they mutate the SQL
+            # exactly once for either MUTATE_AFTER_SPLIT setting, instead of
+            # double-mutating when it's False and never mutating when it's
+            # True.
+            mutated_sql = merged_database.mutate_sql_based_on_config(sql, 
is_split=True)

Review Comment:
   This mirrors the existing `SqlResultExportCommand` (non-streaming SQL Lab 
CSV export), which does the same `select_sql or executed_sql` fallback and 
hands it straight to `get_df()` (also `is_split=True`). Whatever risk there is 
here predates this PR and applies equally to that path, so fixing it here alone 
would just make the two exports inconsistent again. Filed under scope for 
#40465, not this one.



-- 
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