bito-code-review[bot] commented on PR #42739:
URL: https://github.com/apache/superset/pull/42739#issuecomment-5226802438

   <!-- Bito Reply -->
   The current implementation in `superset/commands/streaming_export/base.py` 
introduces a call to `merged_database.mutate_sql_based_on_config(sql)` before 
execution. This addresses the issue where streaming exports previously bypassed 
the SQL mutation hook entirely, which is necessary for operations like 
stripping trailing semicolons required by certain database engines. 
   
   Regarding the concern about non-idempotent mutators running twice: the 
current change applies the mutation once at the start of the streaming export 
process. To further refine the caller contract and ensure idempotency, you 
could introduce a state flag or a specific split phase parameter (e.g., 
`is_split=False`) to `mutate_sql_based_on_config`, as hinted at in the added 
unit test `test_streaming_export_applies_sql_mutator`.
   
   **superset/commands/streaming_export/base.py**
   ```
   mutated_sql = merged_database.mutate_sql_based_on_config(sql)
   
               with merged_database.get_sqla_engine(
                   catalog=catalog, schema=schema
               ) as engine:
                   with engine.connect() as connection:
                       result_proxy = connection.execution_options(
                           stream_results=True
                       ).execute(text(mutated_sql))
   ```


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