mikebridge opened a new pull request, #44261: URL: https://github.com/apache/superset/pull/44261
### SUMMARY The activity fetch executed its streaming SELECTs via `db.session.connection().execution_options(stream_results=True)` — and `Connection.execution_options` **mutates the connection in place**, permanently flipping the request session into server-side-cursor mode. On PostgreSQL, every later statement on the same request — Continuum's `version_transaction` INSERT, SAVEPOINTs, and notably the **DBEventLogger write that follows any activity read** — then gets wrapped in `DECLARE ... CURSOR WITHOUT HOLD FOR ...` and fails with `psycopg2.errors.SyntaxError` (the event write is swallowed by the logger's error handler, so activity-endpoint telemetry is silently lost on PG deployments today). Surfaced deterministically by sc-120488's tests, which write through the same session after `get_activity` — CI traceback: [run 34888050672 / job 104123743848](https://github.com/apache/superset/actions/runs/34888050672/job/104123743848). The fix rides the option on each SELECT statement inste ad — dialect-neutral, one-line, no connection mutation. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — connection semantics. ### TESTING INSTRUCTIONS `pytest tests/integration_tests/versioning/activity_write_after_read_tests.py` — an activity read followed by an INSERT + commit on the same session (the DBEventLogger shape). Control-verified on PostgreSQL 16: reverting the fix fails the test with the DECLARE-CURSOR syntax error; green on SQLite/MySQL either way (only PG maps stream_results to server-side cursors). ### ADDITIONAL INFORMATION - [x] Has associated issue: sc-120955 - [ ] 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JRLEJS4mUqKBoPjSjviKUW -- 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]
