Skip to main content

Entity relationship diagrams for Python data model classes like Pydantic.

Project description

erdantic: Entity Relationship Diagrams

Docs Status PyPI conda-forge tests codecov

erdantic is a simple tool for drawing entity relationship diagrams (ERDs) for Python data model classes. Diagrams are rendered using the venerable Graphviz library. Supported data modeling frameworks are:

Features include a convenient CLI, automatic native rendering in Jupyter notebooks, and easy extensibility to other data modeling frameworks. Docstrings are even accessible as tooltips for SVG outputs. Great for adding a simple and clean data model reference to your documentation.

Example diagram created by erdantic

Installation

erdantic's graph modeling depends on pygraphviz and Graphviz, an open-source C library. The simplest way to install Graphviz is with conda. For other options and installation troubleshooting, see the pygraphviz docs.

To install erdantic:

pip install https://github.com/drivendataorg/erdantic.git#egg=erdantic

Quick Usage

The fastest way to produce a diagram like the above example is to use the erdantic CLI. Simply specify the full dotted path to your data model class and an output path. The rendered format is interpreted from the filename extension.

erdantic erdantic.examples.pydantic.Party -o diagram.png

You can also import the erdantic Python library and use its functions.

import erdantic as erd
from erdantic.examples.pydantic import Party

# Easy one-liner
erd.draw(Party, out="diagram.png")

# Or create a diagram object that you can inspect and do stuff with
diagram = erd.create(Party)
diagram.models
#> [PydanticModel(Adventurer), PydanticModel(Party), PydanticModel(Quest), PydanticModel(QuestGiver)]
diagram.draw("diagram.png")

Check out the "Usage Examples" section of our docs to see more.

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

erdantic-0.1.1.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

erdantic-0.1.1-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file erdantic-0.1.1.tar.gz.

File metadata

  • Download URL: erdantic-0.1.1.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7

File hashes

Hashes for erdantic-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7f8c3decbfee0e615e00211739544bc63adbff746bca0bd42a3cdd258d16bd1f
MD5 0f9b3ba415d6970793dea2ced7fd449b
BLAKE2b-256 222b2c12379626fd2726eb820209d4409aac1b9a315be74486bcadab0e952e74

See more details on using hashes here.

File details

Details for the file erdantic-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: erdantic-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7

File hashes

Hashes for erdantic-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb0ae96607606392bee8f7a9ab52b705a3e0aabef39b1c349227f5bac6fa561f
MD5 9540e70115d125f17deafae700be2a1f
BLAKE2b-256 ab9cc1c7b3a2b77295f2237ea0caf602e54749cac3342ebcbaecd6c9f79eade0

See more details on using hashes here.

Supported by

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