mirror of
https://github.com/apache/superset.git
synced 2026-09-01 21:11:28 +00:00
Root cause: Flask-SQLAlchemy 2.x's SignallingSession.__init__ explicitly passed `bind=<default engine>` into the SQLAlchemy Session constructor. Flask-SQLAlchemy 3.x dropped that - it resolves the engine per-call via Session.get_bind() (consulting the app's registered engines) instead of fixing one at session-construction time, to support its reworked multi-engine/multi-bind model. db.session.bind is therefore always None under FSA 3.x; it was never a documented API, just an implementation detail of FSA 2.x's Session subclass. Confirmed locally: `db.session.bind` prints None while `db.session.get_bind()` correctly resolves the live Engine, against this branch's real flask-sqlalchemy==3.1.1/sqlalchemy==2.0.51 install. Fixes the "AttributeError: 'NoneType' object has no attribute 'dialect'" failures in dashboards/soft_delete_tests.py's partial-index dialect detection, and pre-emptively fixes the same pattern in versioning/id_reuse_tests.py (skipped under postgres/current in the CI run that surfaced this, so not in the failure log there, but broken by the same mechanism whenever it does run). Verified locally against both sqlite and a real postgres:17-alpine container: dashboards/soft_delete_tests.py and versioning/id_reuse_tests.py pass clean on both backends after this fix.