Skip to main content

erdalchemy

erdalchemy is an interactive ERD visualizer for SQLAlchemy 2.0 models. Point it at your DeclarativeBase and get a diagram, no manual configuration.

preview

  • 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:

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

Release files for erdalchemy 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for erdalchemy 0.6.0
File Size Uploaded
erdalchemy-0.6.0.tar.gz 1.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for erdalchemy 0.6.0
File Interpreter ABI Platform
erdalchemy-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / erdalchemy-0.6.0.tar.gz

Download URL erdalchemy-0.6.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
019d266402b9bc423e18c1e519f9c6a47d80d13ee1bceb1832fe2409e3fd930c
BLAKE2b-256 checksum
How to use checksums
df60563e8ab08193418d9f382611dc8c4b531cecd8f061fd574fa5b4cf1f5de7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / erdalchemy-0.6.0-py3-none-any.whl

Download URL erdalchemy-0.6.0-py3-none-any.whl
Size 36.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c216973b5673babb9e3f3a2c57fc921330d5b62be87d1641fb7ed754f663f4ce
BLAKE2b-256 checksum
How to use checksums
001f951f7d7c2843a497bafe8842a253f49bc45a6c66ae7d032337ce37232914
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page