Skip to content

experiment: test model_class= fix for FSA 3.x break (DO NOT MERGE) - #42789

Closed
rusackas wants to merge 1 commit into
masterfrom
experiment/fab-model-class-fix
Closed

experiment: test model_class= fix for FSA 3.x break (DO NOT MERGE)#42789
rusackas wants to merge 1 commit into
masterfrom
experiment/fab-model-class-fix

Conversation

@rusackas

@rusackas rusackas commented Aug 5, 2026

Copy link
Copy Markdown
Member

SUMMARY

Investigation only, do not merge. Testing a theory for the flask-sqlalchemy 3.x break reverted in #42542.

Root cause theory: Flask-AppBuilder's FSA-3.x compatibility shim (flask_appbuilder/models/sqla/base.py) doesn't wire model_class= through when it constructs SQLA(), unlike its FSA-2.x shim (base_legacy.py), which explicitly rebinds Superset's models onto FAB's own declarative_base() via create_session()/get_bind() overrides. Under FSA 3.x, Superset's models (all subclassing flask_appbuilder.Model) and db.session's bind resolution end up looking at two disconnected declarative registries.

This branch tests whether the fix is entirely Superset-side: passing model_class=flask_appbuilder.models.sqla.Model explicitly when constructing db = get_sqla_class()() in superset/extensions/__init__.py. Confirmed locally that this unifies db.Model with flask_appbuilder.Model (db.Model is FABModel is True). Local pytest against sqlite doesn't reproduce the original break either way (matches #42542's own finding that this only ever surfaced under real CI), so this PR exists purely to get a CI signal on test-sqlite/test-mysql.

Full context: discussion #40273, step 6.

TESTING INSTRUCTIONS

N/A, investigation only.

ADDITIONAL INFORMATION

  • Has associated issue
  • Required feature flags:
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

Investigation-only commit for discussion #40273 / PR #42542's revert.
Passes model_class=flask_appbuilder.models.sqla.Model explicitly when
constructing SQLA() in superset/extensions/__init__.py, testing the
theory that FAB's FSA-3.x shim (base.py) leaves Superset's models and
db.session looking at two disconnected declarative registries, since
unlike the FSA-2.x shim (base_legacy.py) it never wires model_class
through.

Local pytest runs against sqlite reproduce neither the break nor a fix
signal (matches PR #42542's original finding that this only surfaced
under real CI). This commit exists to get a real CI signal on
test-sqlite/test-mysql before deciding whether to pursue this as an
actual fix (and whether it needs an upstream flask-appbuilder change
too, or is fixable entirely on Superset's side as this attempts).
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.84%. Comparing base (1605676) to head (8e01205).
⚠️ Report is 2 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (1605676) and HEAD (8e01205). Click for more details.

HEAD has 28 uploads less than BASE
Flag BASE (1605676) HEAD (8e01205)
python 22 3
presto 4 1
hive 4 1
unit 4 1
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42789      +/-   ##
==========================================
- Coverage   65.79%   56.84%   -8.95%     
==========================================
  Files        2842     2842              
  Lines      162106   162107       +1     
  Branches    37148    37148              
==========================================
- Hits       106653    92152   -14501     
- Misses      53388    69116   +15728     
+ Partials     2065      839    -1226     
Flag Coverage Δ
hive 38.07% <100.00%> (-0.01%) ⬇️
mysql ?
postgres ?
presto 39.99% <100.00%> (-0.01%) ⬇️
python 41.20% <100.00%> (-18.13%) ⬇️
sqlite ?
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.

@rusackas

rusackas commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

Theory disproven, see #39278 for the corrected finding. Closing, not merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants