gcbibek3353 commented on PR #45057:
URL: https://github.com/apache/superset/pull/45057#issuecomment-6105166827

   Thanks for the feedback! Added tests in two commits:
   
   **Unit tests** (`tests/unit_tests/commands/sql_lab/export_test.py`):
   - `test_csv_export_uses_full_sql_for_multi_statement_query` — the primary 
regression guard. Sets `query.sql` and `query.executed_sql` to deliberately 
different values (exactly as they are after `sql_lab.py`'s loop), then asserts 
both `SQLScript` and `get_df()` are called with the full SQL including the 
`SET` statements. This test would have failed on the old code.
   - `test_csv_export_uses_full_sql_for_single_statement_query` — sanity check 
that single-statement queries are unaffected (`sql == executed_sql`, so the 
change is transparent).
   
   **Integration test** (`tests/integration_tests/sql_lab/commands_tests.py`):
   - `test_run_no_results_backend_multi_statement_sql` — creates a real `Query` 
row with `sql` set to the full multi-statement script and `executed_sql` set to 
only the `SELECT`, runs the command, and asserts `get_df` received the full 
SQL. Would have failed before the fix.
   - Also updated the two existing `executed_sql` tests 
(`test_run_no_results_backend_executed_sql` and 
`test_run_no_results_backend_executed_sql_limiting_factor`) to set `query.sql` 
with the `LIMIT` clause, since the limit is now extracted from `query.sql` 
rather than `query.executed_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