DBWarden
Your models are the source code. SQL is the output.
DBWarden is a declarative schema compiler for SQLAlchemy. You declare the schema you want in your SQLAlchemy models, and DBWarden compiles everything else: migration SQL, rollbacks, snapshots, and safety checks. There are no migration scripts to write or maintain. Your models are the contract.
This organization is the home of the DBWarden project and its official plugins.
# install DBWarden
uv add dbwarden
# create a configuration
echo "
from dbwarden import DbwardenDatabase
class Primary(DbwardenDatabase):
database_name = 'primary'
database_type = 'postgresql'
database_url_sync = 'postgresql://user:pass@localhost:5432/myapp'
default = True
" > dbwarden.py
# generate your first migration
dbwarden make-migrations "create initial tables"
# apply it
dbwarden migrate| Plugin | Description |
|---|---|
| dbwarden-seeds | Seed data management |
| dbwarden-fastapi | FastAPI sessions, lifespan, and health routes |
| dbwarden-sandbox | Safe declaration parsing without code execution |
| dbwarden-pgsql-rbac | PostgreSQL roles, grants, and row-level security |
| dbwarden-pgsql-extensions | PostgreSQL extension management |
| dbwarden-pgsql-types | PostgreSQL custom types and sequences |
| dbwarden-ch-rbac | ClickHouse access control |
Browse community plugins on PyPI
Use the dbwarden-plugin-template to scaffold a new plugin: click Use this template, run one command, and you have a working, tested, publishable plugin with the standard layout.
Full plugin development guide: docs.dbwarden.org/plugins
Full documentation with guides, cookbook, and API reference:
docs.dbwarden.org
We welcome contributions to the core tool and to plugins.
Start with the core contribution guide or jump into any plugin’s issue tracker.
DBWarden and all official plugins are released under the MIT License.