Interactive ERD visualization for SQLAlchemy 2.0 models
Project description
erdalchemy
Interactive ERD visualizer for SQLAlchemy 2.0 models. Point it at your DeclarativeBase and get a diagram, no manual configuration.
- Drag-and-drop interactive HTML, with hover highlighting
- Three layouts: hierarchical layered (default), force-directed, and star
- Orthogonal edge routing that follows foreign keys without cutting across cards
- Regex filtering to focus large schemas (include/exclude tables and columns)
- Export to HTML, SVG, PNG, and PDF
- Built-in themes and per-table color overrides
- Multi-schema support with cross-schema FKs
- Zero dependencies beyond SQLAlchemy
Install
pip install erdalchemy
PNG and PDF export need an optional dependency:
pip install "erdalchemy[all]"
Quick start
from sqlalchemy_erd import generate_erd
from myapp.models import Base
generate_erd(Base, output="erd.html")
Or from the command line:
sqlalchemy-erd myapp.models:Base --format svg --output erd.svg
Layouts
| Layout | When to use |
|---|---|
layered (default) |
General purpose. Ranks tables into columns by FK direction; cards never overlap. Best for large or wide schemas. |
force |
Small, highly-connected graphs where an organic shape reads better. |
star |
Star/snowflake and ETL schemas, or many disconnected tables. |
generate_erd(Base, output="erd.html", layout="layered")
Documentation
Full reference (every CLI flag, the Python API, themes, layout tuning, card sizing, and supported column types) lives in docs/reference.md.
Examples
See examples/ for ready-to-run schemas:
showcase/- 12 tables across four FK levels (the preview above)blog/- blog schema (User, Post, Comment)ecommerce/- 1:N chainsuniversity/- N:N via association tableshr/- 1:1 and 1:Nmulti_schema/- cross-schema FKs
Acknowledgments
Inspired by eralchemy2 (originally eralchemy), which pioneered generating ER diagrams from SQLAlchemy models. erdalchemy reimagines the idea with a self-contained, interactive, dependency-free renderer.
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file erdalchemy-0.5.0.tar.gz.
File metadata
- Download URL: erdalchemy-0.5.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
659362a6079b804c3380ea91352d9ca5395e5e3a9a73a8830cb0a2d18b9c44fe
|
|
| MD5 |
53e7dae8a9943af935e1f52ac0078244
|
|
| BLAKE2b-256 |
efb039a92239f86d87a473a17c870b66e5a0e318158211d2744bf166e766cc49
|
File details
Details for the file erdalchemy-0.5.0-py3-none-any.whl.
File metadata
- Download URL: erdalchemy-0.5.0-py3-none-any.whl
- Upload date:
- Size: 33.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ab1ee76245b629271ac8c8be4445fb58500d04adb0e25f491a4cd144b3c5484
|
|
| MD5 |
476c2e6c0504f8fa4c1687a032b3cdd5
|
|
| BLAKE2b-256 |
585b96ea33a163834049a829546d9c38551be7ff570871470350031cbd8783e2
|