agronholm/sqlacodegen
Automatic model code generator for SQLAlchemy observed · 2026-08-28
Health v2 · maintenance only
92/100
- Activity 91
- Release rhythm 89
- Longevity 100
Flags: no_license
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 17
- age_days: 3535
- days_rel: 75
- days_push: 58
- n_releases_24m: 12
Adoption not part of the score
2365 stars · 284 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
sqlacodegen is a command-line tool that reads the structure of an existing database and generates SQLAlchemy model code, preferring declarative style. It supports SQLAlchemy 2.x, produces PEP 8 compliant output, and accurately detects relationships including many-to-many and one-to-one.
Use cases
- generate SQLAlchemy models from an existing database schema
- reverse engineer a PostgreSQL database into declarative model classes
- create SQLAlchemy dataclass models from a SQLite database
- generate ORM code for a MySQL database
- bootstrap ORM models for a legacy database
- introspect database tables and relationships into Python code
When to choose
- you have an existing database and want SQLAlchemy models without writing them by hand
- you need accurate relationship detection including many-to-many and joined table inheritance
- you want PEP 8 compliant, hand-written-looking declarative code
- you need support for PostgreSQL extension types like CITEXT, PostGIS geometry, or pgvector
When to avoid
- you are designing models first and want migrations from models to database (use Alembic instead)
- you use an ORM other than SQLAlchemy
- you need a GUI-based database modeling tool
Facets
cli-tool · maturity active
orm database cli databases developer-tools backend python cli cross-platform sqlalchemy model-generation database-introspection reverse-engineering declarative-models code-generation
2 sources
- readme: https://github.com/agronholm/sqlacodegen · fetched 2026-08-28 · efee150c84f6
- registry_pypi: https://pypi.org/pypi/sqlacodegen/json · fetched 2026-08-29 · 2743321b48a8
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| agronholm/sqlacodegen | main | 92 |
For agents
markdown · JSON · MCP: product_card(name="agronholm/sqlacodegen")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem