Skip to content

fix(migration): use sqlalchemy.orm.declarative_base to avoid MovedIn20Warning - #42056

Merged
aminghadersohi merged 1 commit into
apache:masterfrom
fitzee:fix/declarative-base-import-migration
Jul 15, 2026
Merged

aminghadersohi merged 1 commit into
apache:masterfrom
fitzee:fix/declarative-base-import-migration

Conversation

@fitzee

@fitzee fitzee commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

The migration added in #41591 imported declarative_base from the deprecated sqlalchemy.ext.declarative path. SQLAlchemy 1.4 moved it to sqlalchemy.orm.declarative_base and emits MovedIn20Warning on the old path.

The migration file is imported at pytest collection time by its unit test, which means any test run with warnings-as-errors fails at collection — blocking unrelated PRs (e.g. #42052).

One-line fix: update the import to the canonical sqlalchemy.orm path.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

  1. pytest tests/unit_tests/migrations/test_strip_metricsqlexpressions_from_ag_grid_params.py — should pass with no MovedIn20Warning
  2. Confirm no sqlalchemy.exc.MovedIn20Warning at collection time

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@bito-code-review

bito-code-review Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #42e52e

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: ad0cfb6..ad0cfb6
    • superset/migrations/versions/2026-06-30_00-00_d24e6b0a9c7f_strip_metricsqlexpressions_from_ag_grid_params.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added the risk:db-migration PRs that require a DB migration label Jul 15, 2026
@codecov

codecov Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.06%. Comparing base (be768ef) to head (ad0cfb6).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42056      +/-   ##
==========================================
+ Coverage   64.49%   65.06%   +0.56%     
==========================================
  Files        2747     2747              
  Lines      153843   153843              
  Branches    35268    35268              
==========================================
+ Hits        99221   100095     +874     
+ Misses      52712    51838     -874     
  Partials     1910     1910              
Flag Coverage Δ
hive 39.06% <ø> (ø)
mysql 57.89% <ø> (ø)
postgres 57.94% <ø> (ø)
presto 41.04% <ø> (ø)
python 59.32% <ø> (+1.16%) ⬆️
sqlite 57.55% <ø> (ø)
unit 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aminghadersohi
aminghadersohi merged commit 9db8820 into apache:master Jul 15, 2026
62 checks passed
rdg0 pushed a commit to rdg0/superset that referenced this pull request Jul 20, 2026
…0Warning (apache#42056)

Co-authored-by: Matt Fitzgerald <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:db-migration PRs that require a DB migration size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants