SQLAlchemy Admin for Starlette/FastAPI
General info
SQLAdmin is a flexible Admin interface for SQLAlchemy models.
Main features include:
- SQLAlchemy sync/async engines
- Starlette integration
- FastAPI integration
- WTForms form building
- SQLModel support
- UI using Tabler
Documentation: https://smithyhq.github.io/sqladmin
Source Code: https://github.com/smithyhq/sqladmin
Live Demo: https://sqladmin-demo.vercel.app/admin (Username: superadmin Password: superadmin)
Installation
Install using pip:
$ pip install sqladmin
Some features need extra packages, which are grouped into optional extras:
| Extra | Installs | Enables |
|---|---|---|
auth |
itsdangerous |
Session-backed authentication |
i18n |
babel |
Internationalization and localization |
full |
both of the above | Everything |
$ pip install "sqladmin[auth]"
$ pip install "sqladmin[i18n]"
$ pip install "sqladmin[full]"
Screenshots
Quickstart
Let's define an example SQLAlchemy model:
from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.orm import declarative_base
Base = declarative_base()
engine = create_engine(
"sqlite:///example.db",
connect_args={"check_same_thread": False},
)
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True)
name = Column(String)
Base.metadata.create_all(engine) # Create tables
If you want to use SQLAdmin with FastAPI:
from fastapi import FastAPI
from sqladmin import Admin, ModelView
app = FastAPI()
admin = Admin(app, engine)
class UserAdmin(ModelView, model=User):
column_list = [User.id, User.name]
admin.add_view(UserAdmin)
Or if you want to use SQLAdmin with Starlette:
from sqladmin import Admin, ModelView
from starlette.applications import Starlette
app = Starlette()
admin = Admin(app, engine)
class UserAdmin(ModelView, model=User):
column_list = [User.id, User.name]
admin.add_view(UserAdmin)
Now visiting /admin on your browser you can see the SQLAdmin interface.
Related projects and inspirations
- Flask-Admin Admin interface for Flask supporting different database backends and ORMs. This project has inspired SQLAdmin extensively and most of the features and configurations are implemented the same.
- FastAPI-Admin Admin interface for FastAPI which works with
TortoiseORM. - Dashboard Admin interface for ASGI frameworks which works with the
ormpackage.
Metadata
Release files for sqladmin 0.31.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqladmin-0.31.1.tar.gz | 1.0 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqladmin-0.31.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.1 MB
Release files / sqladmin-0.31.1.tar.gz
| Download URL | sqladmin-0.31.1.tar.gz |
|---|---|
| Size | 1.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27f39dd851645ac3f059cf98e91372898e485c8c63a9e60eb287af2dcc571e3f
|
|
BLAKE2b-256 checksum How to use checksums |
6f74277739921c1f8d44a9a40fda6efd18046b5f277c4ba544e36c324bfc9ca1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / sqladmin-0.31.1-py3-none-any.whl
| Download URL | sqladmin-0.31.1-py3-none-any.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b74d40d0585268d71bd7653e9d99442bbc3e6e3112a670bd53e29d225be7659
|
|
BLAKE2b-256 checksum How to use checksums |
13c7b0e1edf56b637117527891ec5cbed0ca27b32893ed872f9913d8d9ceb9fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|