I3eka opened a new pull request, #45561: URL: https://github.com/apache/superset/pull/45561
### SUMMARY A synchronous `Database.execute()` call can return a failed or timed-out result while its persisted SQL Lab `Query` remains `running`. OAuth failures after the query record is created leave the same stale state. Finalize that record with the terminal status, error message, and end time. Return its existing query ID with error results so callers can inspect the record. Roll back a failed metadata transaction before saving the failure; OAuth exceptions still propagate to their callers. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF No visual change requiring screenshots. | Execution outcome | Before | After | | --- | --- | --- | | SQL error | Result is failed; stored query remains running | Result and stored query are failed | | Timeout | Result is timed out; stored query remains running | Result and stored query are timed out | | OAuth error | Exception propagates; stored query remains running | Exception propagates; stored query is failed | ### TESTING INSTRUCTIONS Run `pytest -q tests/unit_tests/sql/execution` (757 passed, 3 skipped locally). The new parameterized regression fails in all three cases on unmodified master and passes with this change. For a manual check, call `Database.execute()` against an authorized test database with a read-only query referencing a nonexistent column. Inspect the returned `query_id` through a fresh metadata session: the record should have `status="failed"`, the returned error message, and an end time. This was also verified against SQL Server using a synthetic `VALUES` query, without accessing business tables. Changed-file pre-commit checks pass. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] 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]
