SQLAdmin is a flexible and actively developed admin interface for SQLAlchemy models, designed for use with FastAPI and Starlette. It provides a UI for managing database models, leveraging WTForms for form building and Tabler for the UI. The library maintains a regular release cadence, with updates typically occurring every few weeks to a month.
Install & Compatibility
Where this runs
tested against v0.27.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.940 runs
installs and imports cleanly · install 0.0s · import 1.189s · 50.6MB
glibcpy 3.10–3.940 runs
installs and imports cleanly · install 4.0s · import 1.079s · 49MB
49MB installed
● package 49MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from sqladmin import Admin
from sqladmin import ModelView
AuthenticationBackend is in a submodule, not directly under sqladmin.
from sqladmin.authentication import AuthenticationBackend
This quickstart demonstrates how to integrate SQLAdmin into a FastAPI application, defining a simple SQLAlchemy model and exposing it through the admin panel. It sets up an in-memory SQLite database and registers a `UserAdmin` view.
import os
from fastapi import FastAPI
from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.orm import declarative_base, sessionmaker
from sqladmin import Admin, ModelView
# 1. Database Setup
DATABASE_URL = os.environ.get("DATABASE_URL", "sqlite:///./example.db")
engine = create_engine(DATABASE_URL, connect_args={"check_same_thread": False})
Base = declarative_base()
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True)
name = Column(String, default="Anonymous")
email = Column(String, unique=True, nullable=False)
Base.metadata.create_all(engine)
# 2. FastAPI App Setup
app = FastAPI(title="My SQLAdmin App")
# 3. SQLAdmin Setup
admin = Admin(app, engine, title="My Admin Panel")
# 4. Define ModelView
class UserAdmin(ModelView, model=User):
column_list = [User.id, User.name, User.email]
column_searchable_list = [User.name, User.email]
column_sortable_list = [User.id, User.name, User.email]
column_default_sort = ('id', True)
# 5. Add ModelView to Admin
admin.add_view(UserAdmin)
@app.get("/")
async def read_root():
return {"message": "Welcome! Visit /admin for the admin panel."}
# To run this:
# pip install fastapi uvicorn sqladmin sqlalchemy
# uvicorn your_module_name:app --reload
# Then navigate to http://127.0.0.1:8000/admin in your browser.
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.