Skip to main content

🗃️ erdify

PyPI version Python versions License: MIT Tests Coverage Docs

🚀 Generate beautiful PlantUML Entity Relationship Diagrams from your SQLModel, SQLAlchemy, Django, Pydantic and dataclass models automatically!

erdify parses your model files using AST (Abstract Syntax Tree) and generates comprehensive ERD diagrams in PlantUML format. It supports SQLModel, SQLAlchemy 2.0, Django ORM, Pydantic and standard-library dataclasses — and raw SQL DDL files (.sql) via the optional erdify[sql] extra. No database connection required!

✨ Features

  • 🧬 5 Python Frameworks + SQL DDL - SQLModel, SQLAlchemy 2.0, Django ORM, Pydantic, dataclasses, and raw .sql files (via erdify[sql])
  • 🔍 AST-Based Parsing - No imports needed, works with any valid Python code
  • 🎯 Zero dependencies by default — core uses only the stdlib; SQL support is an opt-in extra (erdify[sql])
  • 🔗 Relationship Detection - Foreign keys, relationships and many-to-many link tables
  • 🧜 4 Output Formats - --format emits PlantUML, Mermaid (renders natively on GitHub), JSON, or a self-contained HTML preview
  • 📝 Markdown Embed - --inject writes the diagram into a Markdown file between markers
  • ⚙️ Config File - Store options under [tool.erdify] in pyproject.toml
  • ✅ Drift Check - --check fails CI/pre-commit when the committed diagram is stale

See the full feature matrix for everything erdify recognizes.

🤔 Why erdify and not X?

erdify paracelsus eralchemy sqlalchemy-schemadisplay erdantic graph_models DBML/dbdiagram
Needs a live DB connection No No Optional Optional No No Only for db2dbml
Imports/executes your code No Yes Yes Yes Yes Yes (full Django setup) n/a
Frameworks read 5 + SQL DDL SQLAlchemy SQLAlchemy SQLAlchemy Pydantic, attrs, msgspec, dataclasses Django SQL dumps
Runtime dependencies None SQLAlchemy, pydot, typer SQLAlchemy + Graphviz SQLAlchemy, pydot, Graphviz pydantic, pygraphviz, … Django + Graphviz Node.js
CI drift gate --check --check No No No No No

erdify reads your source with the stdlib ast module, so it runs in a docs pipeline, a pre-commit hook or a CI job against a repository it cannot even install — and one command covers five frameworks plus raw SQL, where every other tool here covers one. That is a trade-off, not a free win: anything your code builds at runtime is invisible to it, and none of these tools renders images for you.

👉 Full comparison, including when to use something else

🚀 Quick Start

# Run without installing (or `pip install erdify`)
uvx erdify ./src/database -o erd.puml
# Output to stdout, with a custom title
erdify ./src/models --title "My Database Schema"

See the documentation for installation options, the full CLI, the Python API and more.

🧬 One Schema, Five Frameworks

The same User / Order schema in SQLModel, SQLAlchemy 2.0, Django, Pydantic and dataclasses — only the syntax differs. Each one produces the identical diagram:

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

erdify docs/examples/sqlmodel --inject README.md keeps the diagram below in this file. It is Mermaid, so GitHub renders it directly — and a pre-commit hook runs the same command with --check, so it cannot go stale:

erDiagram
    User {
        int id PK
        str name
        str email
    }
    Order {
        int id PK
        int user_id FK
        float total
    }
    Order }o--|| User : "user_id"

👉 See the full side-by-side comparison and the detection/parsing table in the Frameworks Overview (with a worked example and Django specifics). The runnable sources live in docs/examples/.

📚 Documentation

📋 Supported Features

Primary/foreign keys, nullable fields, defaults, indexes, enums, relationships, inheritance, link tables, custom table names and per-framework specifics — see the full feature matrix in the docs.

💬 Community

Questions, ideas, or want to show off an ERD erdify generated? Join the Discussions. For open-ended topics and feature direction, Discussions are the place; concrete bugs and proposals go to Issues.

🤝 Contributing

Contributions are welcome! Have a bug or a concrete feature request? Please open an issue, and see CONTRIBUTING.md for guidelines. Shipped changes are tracked in the changelog.

🔒 Security

For security concerns, please see SECURITY.md.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

erdify stands on the shoulders of great open-source projects:

Supported model frameworks

  • SQLModel - The awesome SQL database library
  • SQLAlchemy - The Python SQL toolkit and ORM
  • Django - The web framework whose ORM models erdify parses
  • Pydantic - Data validation using Python type hints
  • dataclasses - Python standard-library data classes

Rendering & output

  • PlantUML - For the diagram rendering
  • Graphviz - Layout engine behind PlantUML's ER diagrams
  • Mermaid - Renders the --format mermaid / html output

Tooling & infrastructure

  • uv - Packaging, builds and dependency management
  • Ruff - Linting and formatting
  • mypy - Static type checking
  • pytest - Testing framework
  • pre-commit - Git hook management

Community


Created & maintained with ❤️ by devsuit GmbH

Metadata

Release files for erdify 1.1.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 erdify 1.1.0
File Size Uploaded Provenance Actions
erdify-1.1.0.tar.gz 37.6 kB Without provenance Details for erdify-1.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 79.0 kB

Release files / erdify-1.1.0.tar.gz

Download URL erdify-1.1.0.tar.gz
Size 37.6 kB
Tags Source
SHA-256 checksum
How to use checksums
73c12ee89311a157c9c0d74d447efc5096bd4890ace08ed67032666a4ff5de43
BLAKE2b-256 checksum
How to use checksums
02fc278c1a571226eae382a250bc95a84c7223a4c042b1a722c7d049751b445c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / erdify-1.1.0-py3-none-any.whl

Download URL erdify-1.1.0-py3-none-any.whl
Size 41.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f08f561b341b50cedd6662fe5654774b1353bbac203671029ce5dccda8be8d0
BLAKE2b-256 checksum
How to use checksums
72fe32a512874bad892b4a59ac718014fbb6126cd96c53b4256a9f0e363479aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for erdify 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

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