Repository navigation
Conversation
Code Review Agent Run #ff1d28Actionable Suggestions - 0Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR updates the codebase to use SQLAlchemy’s 1.4/2.0-style select() calling convention (positional columns instead of legacy list-based usage), and adjusts pytest warning configuration to surface/deprecate specific SQLAlchemy 2.0 warnings during local runs.
Changes:
- Refactor legacy
select([ ... ])/select(list_of_cols)calls toselect(col1, col2, ...)orselect(*cols). - Update core query construction sites (engine specs, helpers, metadb, import utils) and unit tests accordingly.
- Replace
-p no:warningswithfilterwarningsrules and error on the legacyselect()calling style.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit_tests/db_engine_specs/test_mssql.py | Updates select() usage in MSSQL engine spec unit test. |
| tests/unit_tests/db_engine_specs/test_datastore.py | Updates select(*fields) usage in Datastore engine spec unit test. |
| tests/unit_tests/db_engine_specs/test_bigquery.py | Updates select(*fields) usage in BigQuery engine spec unit test. |
| superset/utils/core.py | Updates connection ping to select(1) in pessimistic connection handling. |
| superset/models/helpers.py | Refactors multiple query builders to SQLAlchemy 2.0-style select() calls. |
| superset/migrations/versions/2024-01-17_13-09_96164e3017c6_tagged_object_unique_constraint.py | Refactors select() usage in migration cleanup subquery and delete query. |
| superset/migrations/versions/2022-04-01_14-38_a9422eeaae74_new_dataset_models_take_2.py | Refactors many select() calls used for insert_from_select migration logic. |
| superset/migrations/versions/2020-04-24_10-46_e557699a813e_add_tables_relation_to_row_level_.py | Refactors select() usage in upgrade/downgrade migration logic. |
| superset/migrations/versions/2020-01-08_01-17_e96dbf2cfef0_datasource_cluster_fk.py | Refactors select() usage in datasource/cluster FK migration. |
| superset/extensions/metadb.py | Refactors table/count selects to SQLAlchemy 2.0-style select(). |
| superset/db_engine_specs/base.py | Refactors select_star() query construction to avoid legacy select(list) usage. |
| superset/connectors/sqla/models.py | Refactors ad-hoc type probe query select() calls. |
| superset/common/tags.py | Refactors tag backfill queries to SQLAlchemy 2.0-style select() calls. |
| superset/commands/importers/v1/utils.py | Refactors relationship lookup query to SQLAlchemy 2.0-style select(). |
| pytest.ini | Switches from -p no:warnings to filterwarnings and errors on legacy select() calling style. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40276 +/- ##
==========================================
- Coverage 64.26% 64.26% -0.01%
==========================================
Files 2660 2660
Lines 144778 144785 +7
Branches 33381 33383 +2
==========================================
- Hits 93045 93043 -2
- Misses 50084 50089 +5
- Partials 1649 1653 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
a81f704 to
821bef9
Compare
|
Just rebased the branch, but this is generally looking ready to approve to my eyes. Would love to have the bot comments addressed, but otherwise just waiting on a second opinion from @villebro @michael-s-molina @betodealmeida @dpgaspar |
Code Review Agent Run #ada842Actionable Suggestions - 0Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
fbc5308 to
3ba3ce7
Compare
@rusackas I have addressed the bot comments, and included their suggestions in the most recent commits. Otherwise, I rebased and re-ran all unit tests, successfully. |
Code Review Agent Run #f81737Actionable Suggestions - 0Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
rusackas
left a comment
There was a problem hiding this comment.
Thanks for the work here @hy144328, and thanks for the review @betodealmeida.
LGTM2
Forward-compatible groundwork for the SQLAlchemy 1.4 -> 2.0 bump. Every change here is backward-compatible with the current SQLAlchemy 1.4.54 / Flask-SQLAlchemy 2.5.1 baseline, so it does not regress anything while shrinking the eventual version bump. Removed-in-2.0 API fixes (these break on 2.0 but still work on 1.4): - `sqlalchemy.orm.eagerload` (removed alias of `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 FSA 3.x, required by SA 2.0) -> import 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 -> wrap startup health check in a `Connection` + `text()`, and the secrets re-encryptor in `text()` with a single bind dict and `row._mapping[...]` access. Prospective Annotated Declarative prep (no-ops on 1.4, ease the 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 already landed via #40276 / #40275, so they are intentionally excluded here. Co-Authored-By: Claude Fable 5 <[email protected]>
Forward-compatible groundwork for the SQLAlchemy 1.4 -> 2.0 bump. Every change here is backward-compatible with the current SQLAlchemy 1.4.54 / Flask-SQLAlchemy 2.5.1 baseline, so it does not regress anything while shrinking the eventual version bump. Removed-in-2.0 API fixes (these break on 2.0 but still work on 1.4): - `sqlalchemy.orm.eagerload` (removed alias of `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 FSA 3.x, required by SA 2.0) -> import 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 -> wrap startup health check in a `Connection` + `text()`, and the secrets re-encryptor in `text()` with a single bind dict and `row._mapping[...]` access. Prospective Annotated Declarative prep (no-ops on 1.4, ease the 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 already landed via #40276 / #40275, so they are intentionally excluded here. Co-Authored-By: Claude Fable 5 <[email protected]>
See #40273 .
Depends on #40274 .
SUMMARY
Enable errors for deprecated
sqlalchemy.select()syntax, and fix them all.In addition to fixing all broken tests, I manually went through all results of
git grep select(.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
No errors:
ADDITIONAL INFORMATION