graphviz-erd
Draw Entity Relationship Diagrams (ERD) with python and graphviz.
This code is built on top of the graphviz python package and provides methods to facilitate the declaration of blocks commonly used in ERD such as entities and attributes.
Example
We can draw diagrams like
using the code:
gr = graphviz.Graph("ER", filename="erd", engine="dot", format="png")
obj = ERD(gr)
# node name and node label
obj.entity("entity1", "entity 1")
# the label is optional as it is in graphviz
obj.attribute("attr")
# new lines using the html notation
obj.multivalue("multi", "multivalued<BR/>attribute")
obj.key("key", "key attribute")
obj.derived("derived")
obj.weak_key("weak")
obj.associative_entity("assoc", "associative<BR/>entity")
obj.weak_entity("entity2", "weak entity 2")
# draw relation between entities
obj.relation("relationship", "entity1", "entity2", "(1,2)", "(2, 1)", "yes")
# connect the attributes
obj.gr.edges(
[
("entity1", "attr"),
("entity1", "multi"),
("entity1", "key"),
("entity1", "weak"),
("entity1", "derived"),
]
)
obj.gr.view()
Instructions (Development)
Assuming a linux environment (Ubuntu), to develop inside a virtual environment using git hooks:
python3 -m venv .venv
source .venv/bin/activate
pip install wheel
pip install -r requirements.txt
pre-commit install
Release files for graphviz-erd 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| graphviz-erd-0.0.0.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| graphviz_erd-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / graphviz-erd-0.0.0.tar.gz
| Download URL | graphviz-erd-0.0.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be38d0347acdece38828042a72f74a993ad3c9a1192c015fa723862f0065a66d
|
|
BLAKE2b-256 checksum How to use checksums |
7131249a5d95d74179c4dd9abec5ea6295abeb73f462bfd7e40984344e70d170
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
|
Release files / graphviz_erd-0.0.0-py3-none-any.whl
| Download URL | graphviz_erd-0.0.0-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ac380de6bdb7a75fc53919ad0a3329cca7a0ab6529397fe584f129969193759
|
|
BLAKE2b-256 checksum How to use checksums |
21ebdf0a70cfded6ab2f414236506407281640977e71459a8de16223145b3c1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
|