Skip to main content

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.

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

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

erdalchemy-0.5.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

erdalchemy-0.5.0-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

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

Hashes for erdalchemy-0.5.0.tar.gz
Algorithm Hash digest
SHA256 659362a6079b804c3380ea91352d9ca5395e5e3a9a73a8830cb0a2d18b9c44fe
MD5 53e7dae8a9943af935e1f52ac0078244
BLAKE2b-256 efb039a92239f86d87a473a17c870b66e5a0e318158211d2744bf166e766cc49

See more details on using hashes here.

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

Hashes for erdalchemy-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ab1ee76245b629271ac8c8be4445fb58500d04adb0e25f491a4cd144b3c5484
MD5 476c2e6c0504f8fa4c1687a032b3cdd5
BLAKE2b-256 585b96ea33a163834049a829546d9c38551be7ff570871470350031cbd8783e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page