aminghadersohi opened a new pull request, #43263:
URL: https://github.com/apache/superset/pull/43263
### SUMMARY
Adds a temporary, tested SQLAlchemy 1.4 compatibility lane for downstreams
such as Preset Shell without reverting the SQLAlchemy 2 upgrade from #42803.
The normal OSS lock files and install path remain on SQLAlchemy 2.0.51 with
Flask-SQLAlchemy 3.1.1. Downstreams using the bridge **must constrain both**
SQLAlchemy 1.4.54 and Flask-SQLAlchemy 2.5.1 together, using
`requirements/sqlalchemy14.txt` as the reference pair.
Python package metadata cannot express correlated dependency alternatives
("SQLAlchemy 1.4 + Flask-SQLAlchemy 2.5" or "SQLAlchemy 2 + Flask-SQLAlchemy
3.1"). The widened bounds therefore expose the union needed by a downstream
constraints file; arbitrary cross-pair combinations are not supported.
Excluding Flask-SQLAlchemy 3.0.x, keeping the generated OSS requirements on the
modern pair, and validating the exact legacy pair in CI avoids presenting an
accidental third supported lane.
Runtime compatibility remains narrow:
- use the transaction API shared by SQLAlchemy 1.4 and 2.x when rolling back
the connection health check;
- make a SQL compilation assertion insensitive to version-specific
projection ordering and redundant parentheses while continuing to verify its
permission predicates;
- retain all other SQLAlchemy 2 migration work and post-#42803
session/SAVEPOINT/MCP isolation fixes.
The commonly tested `bigquery`, `druid`, `duckdb`, `fastmcp`, `gevent`,
`gsheets`, `mysql`, `postgres`, `presto`, `prophet`, `trino`, and `thumbnails`
extras are available in both lanes. The selected `dremio`, `exasol`,
`firebird`, `redshift`, and `risingwave` driver lines are explicitly documented
as SQLAlchemy 2-only; their OSS defaults are not silently downgraded. Other
extras are not covered by the legacy lane and require downstream validation.
This is intended as a temporary migration bridge. Once Preset Shell and
other known downstreams have moved to SQLAlchemy 2, remove the paired
constraints, widened lower bounds, compatibility code, documentation, and
legacy CI job together. #43260 remains the broader full-rollback alternative;
this PR does not close it.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable; dependency, backend compatibility, and CI changes only.
### TESTING INSTRUCTIONS
Regenerated dependency artifacts with repository tooling; the generated
files were unchanged and continue to pin SQLAlchemy 2.0.51 / Flask-SQLAlchemy
3.1.1:
```bash
./scripts/uv-pip-compile.sh
```
Validated dependencies and ran the CI-selected app initialization,
ORM/session/engine, migration, SAVEPOINT, MCP isolation, DuckDB, and SQL Lab
tests on both exact stacks:
```text
SQLAlchemy 2.0.51 + Flask-SQLAlchemy 3.1.1: 403 passed, 4 skipped
SQLAlchemy 1.4.54 + Flask-SQLAlchemy 2.5.1: 403 passed, 4 skipped
uv pip check: passed on both stacks
```
Ran a full empty-SQLite `superset db upgrade` successfully on both stacks.
```bash
PRE_COMMIT_HOME=/tmp/pre-commit-cache pre-commit run
# passed
```
The `sqlalchemy14-compatibility` CI job installs the existing development
lock, replaces only the two packages from `requirements/sqlalchemy14.txt`, runs
`uv pip check`, and executes the targeted suite. The existing required SA2
unit-test matrix is unchanged; its stable required anchor now also requires the
compatibility lane.
### 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
- [x] 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]