Add SQLModel backend based on SQLAlchemy ModelView#2898
Open
Nefelibata0516 wants to merge 6 commits into
Open
Conversation
ElLorans
reviewed
May 18, 2026
Contributor
|
Thanks for you PR! A few considerations:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add SQLModel backend support with minimal CRUD integration
Background
This PR implements Issue #2528 by adding SQLModel support to Flask-Admin.
SQLModel is built on top of SQLAlchemy ORM, so the implementation reuses Flask-Admin’s existing SQLAlchemy backend instead of duplicating CRUD/query logic.
Scope
This PR targets a minimal viable integration:
Out of scope for this PR:
Changes
1) New SQLModel backend
flask_admin.contrib.sqlmodelmodule:flask_admin/contrib/sqlmodel/view.pyflask_admin/contrib/sqlmodel/__init__.pySQLModelViewandModelViewalias for ergonomic usage.2) Compatibility layer for SQLModel-specific types
flask_admin.contrib.sqla.ModelViewas base class.AutoStringworks with Flask-Admin’s SQLAlchemy converters:AutoString -> String)AutoString -> string)3) Tests
flask_admin/tests/sqlmodel/test_basic.py4) Example app
examples/sqlmodel/5) CI/stability follow-up fixes
Why this design
ModelViewis the lowest-risk and most maintainable approach.Validation
Local verification
uv run pytest flask_admin/tests/sqlmodel/test_basic.py✅/admin/is accessible ✅CI
Notes
This PR intentionally delivers a minimal, demonstrable integration first.
Advanced SQLModel-specific enhancements can be added incrementally in follow-up PRs.