Skip to content

erdify

One ERD generator for every Python schema in your repository — parsed from source, with no imports, no database connection and no runtime dependencies.

The same User/Order schema in SQLModel, SQLAlchemy, Django, Pydantic and dataclasses, all producing one ERD

The same two tables, written in SQLModel, SQLAlchemy 2.0, Django, Pydantic and dataclasses, all render to the same diagram.

Install and run

uvx erdify ./src/database -o docs/erd.puml        # no install
pip install erdify                                 # or install it
erdify ./src/database --format mermaid -o docs/erd.mmd

That is the whole tool: point it at a directory, get PlantUML, Mermaid, JSON or a self-contained HTML page. --inject writes the diagram straight into a Markdown file, and --check fails your build when it drifts out of date.

Why erdify?

erdify reads your source with the standard library's ast module. It never imports your code and never opens a connection, so it runs in a docs pipeline, a pre-commit hook or a CI job against a repository it cannot even install — and it covers five frameworks plus raw SQL DDL with one command.

How it compares to eralchemy, erdantic, graph_models and DBML, including where each of those is the better choice.

Contents

  • Installation — install via pip, uv, pipx or run with uvx
  • Quickstart — the handful of commands you'll use most, with links to the details
  • Features — the full matrix of what erdify recognizes when parsing your models
  • Comparison — erdify next to the other ERD generators
  • CLI & Python API — command-line options, running as a module, and the Python API (incl. programmatic access)
  • Output Formats — PlantUML and Mermaid, --format, output naming
  • Filtering & Key Inference--exclude, --exclude-paths, --sources, and --infer-keys
  • Viewing the Diagram — render online, locally with PlantUML, or in VS Code
  • CI/CD & pre-commit — keep ERDs up to date in CI and via pre-commit hooks
  • Frameworks Overview — the five frameworks side by side, how each is detected, and a worked example with the generated PlantUML
  • Django ORM — Django-specific parsing details (FK mapping, type mapping, enums, abstract bases, db_table)
  • SQL DDL — generate ERDs from .sql files via the optional erdify[sql] extra (CREATE TABLE, foreign keys, enums)
  • Python Parsing Limitations — what the AST parser cannot see, and what to do instead
  • Troubleshooting — symptom-first fixes for the common surprises