rusackas opened a new pull request, #41179: URL: https://github.com/apache/superset/pull/41179
### SUMMARY Forward-compatible groundwork for the SQLAlchemy 1.4 → 2.0 migration (companion to #40830 / #39735, and a sibling of the already-merged #40276 and the in-flight #40275). **Every change here is backward-compatible with the current `sqlalchemy>=1.4,<2` / `flask-sqlalchemy 2.x` baseline**, so it can land on `master` today without bumping the version, while shrinking the eventual bump and de-risking it. Two categories: **1. Removed-in-2.0 API fixes** — these break on 2.0 but still work on 1.4: - `sqlalchemy.orm.eagerload` (a removed alias of `joinedload`) → `joinedload`, in the security manager. - `sqlalchemy.sql.visitors.VisitableType` (removed) → `sqlalchemy.types.TypeEngine`, in dataset-importer and `mock_data` type hints. - `flask_sqlalchemy.BaseQuery` (removed in Flask-SQLAlchemy 3.x, which SA 2.0 requires) → imported from `flask_sqlalchemy.query.Query` with a fallback to the FSA 2.x path, in the query / saved-query filters and the report command tests. - `Engine.execute` / raw-string execution → startup health check wrapped in a `Connection` + `text()`; secrets re-encryptor uses `text()` with a single bind dict and `row._mapping[...]` access. **2. Prospective Annotated Declarative prep** — no-ops on 1.4, but they ease the eventual 2.0 flip: - `__allow_unmapped__` on the FAB declarative base so legacy 1.x annotations are tolerated during incremental migration. - `Mapped[...]` return annotations on `created_by_fk` / `changed_by_fk` and `BaseDatasource.slices`. The `select()` and `case()` syntax changes from the same effort are intentionally **excluded** here — they already landed via #40276 and are covered by #40275 respectively. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — no user-facing changes. ### TESTING INSTRUCTIONS CI. Locally, all of these were verified against the current `SQLAlchemy 1.4.54` / `Flask-SQLAlchemy 2.5.1` baseline (imports resolve, `BaseQuery` shim falls back correctly, `pre-commit run` is green including mypy/pylint/ruff). They should be a no-op behaviorally on 1.4 and unblock the 2.0 import/boot path. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
