villebro opened a new pull request, #43942: URL: https://github.com/apache/superset/pull/43942
### SUMMARY Child PR 4 of the [SQL execution on GTF epic](https://github.com/apache/superset/pull/43928) (umbrella `villebro/sqllab-gtf`). Wires the SQL Lab `/execute/` endpoint onto the unified execution feature and retires the legacy SQL Lab execution path. **Wiring:** - `ExecuteSqlCommand` now dispatches execution itself (the `SqlJsonExecutor` abstraction is gone): **sync** runs the query in-process via `execute_sql_lab_query`; **async** prepares here and is scheduled by `command.submit_async()`, which the endpoint calls *after* the command's transaction commits — a GTF task cannot be scheduled inside an outer `@transaction` (the `SubmitTaskCommand` "must own its transaction" guard), mirroring how chart-data schedules from its API view. - **Async SQL Lab now requires `GLOBAL_TASK_FRAMEWORK`.** When it is disabled, an async request returns a clear error rather than executing; sync execution is unaffected and needs no flag. Documented in `UPDATING.md`. - **`/query/stop`** (SQL Lab's Stop button / `POST /api/v1/query/stop`) routes through `CancelTaskCommand` when a `superset.sql_lab` task backs the query (found by `client_id`), so stopping from SQL Lab and from the Task List view are the same operation; it falls back to the direct warehouse cancel for sync / non-GTF queries. - The async task is keyed by `Query.client_id` (PRIVATE dedup), which subsumes the classic `is_query_handled` idempotency guard. **Legacy retired:** - Removed `sql_lab.get_sql_results` (Celery task), `sql_lab.execute_sql_statements` / `execute_query` / result serialization, and `superset/sqllab/sql_json_executer.py` (the sync/async `SqlJsonExecutor`s). `superset.sql_lab` still exposes `get_query`, `handle_query_error`, and `cancel_query`. - Dropped the `sql_lab.get_sql_results` `task_annotations` rate-limit and its `CeleryConfig.imports` entry. - Updated/removed the tests that exercised the removed functions; added tests for the new command dispatch, the GTF-required gate, `submit_async`, and the `/query/stop` GTF path. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — behavior-preserving for the user-facing SQL Lab flow (sync + async), with async now backed by GTF. ### TESTING INSTRUCTIONS `pytest tests/unit_tests/sql_lab_test.py tests/unit_tests/commands/sql_lab/ tests/unit_tests/dao/queries_test.py tests/unit_tests/sql/execution/ tests/unit_tests/tasks/test_sql_queries.py` (225 pass). End-to-end (needs a dev instance): run a sync query, run an async query with `GLOBAL_TASK_FRAMEWORK` on (it appears in the Task List and is cancellable there), Stop a running query from SQL Lab and from the Task List, and confirm an async request with the flag off returns the clear "requires GLOBAL_TASK_FRAMEWORK" error. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [x] Required feature flags: `GLOBAL_TASK_FRAMEWORK` (async SQL Lab execution) - [ ] Changes UI - [ ] Includes DB Migration - [x] Introduces new feature or API - [x] Removes existing feature or API -- 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]
