Skip to content

Build Status Publish Status Coverage Package version Supported Python versions


SQLAlchemy Admin for Starlette/FastAPI

SQLAdmin-NG is a flexible, maintained admin interface for SQLAlchemy models, built for FastAPI and Starlette. This project is a maintained fork of SQLAdmin from version v0.23.0, originally created by Amin Alaee. Development continues here due to inactivity in the original repository.

⚠️ This package is a drop-in replacement for sqladmin. Just replace the installation package — no code changes required.

Why this fork?

The original project has been inactive for a while. This fork aims to:

  • Continue maintenance and bug fixes
  • Support newer versions of dependencies
  • Add new features over time

Main features


Documentation: https://mmzeynalli.github.io/sqladmin-ng

Source Code: https://github.com/mmzeynalli/sqladmin-ng

Online Demo: Demo


Installation

Install using pip:

shell $ pip install sqladmin-ng

This will install the full version of sqladmin-ng with optional dependencies:

shell $ pip install "sqladmin-ng[full]"

Migration from sqladmin

bash pip uninstall sqladmin pip install sqladmin-ng

That's it. No need to change existing code.


Screenshots

sqladmin-ng-1 sqladmin-ng-2

Quickstart

Let's define an example SQLAlchemy model:

```python 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-NG with FastAPI:

```python 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-NG with Starlette:

```python 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-NG interface.

  • SQLAdmin The original project that this fork is based on.
  • Flask-Admin Admin interface for Flask supporting different database backends and ORMs. This project has inspired SQLAdmin-NG 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 orm package.