Generate the ERD-as-a-code from dbt artifacts
Project description
dbterd
Generate the ERD-as-a-code (DBML, Mermaid, PlantUML, GraphViz, D2) from dbt artifact files (dbt Core) or from dbt metadata (dbt Cloud)
pip install dbterd --upgrade
Verify installation:
dbterd --version
[!TIP] For
dbt-coreUsers, it's highly recommended to upgradedbt-artifacts-parserto the latest version in order to support the newerdbt-coreversion which would cause to have the new manifest / catalog json schema:
👉pip install dbt-artifacts-parser --upgrade
Quick examine with existing samples
-
Play with CLIs:
Click me
# select all models in dbt_resto dbterd run -ad samples/dbtresto # select all models in dbt_resto, Select multiple dbt resources dbterd run -ad samples/dbtresto -rt model -rt source # select only models in dbt_resto excluding staging dbterd run -ad samples/dbtresto -s model.dbt_resto -ns model.dbt_resto.staging # select only models in schema name mart excluding staging dbterd run -ad samples/dbtresto -s schema:mart -ns model.dbt_resto.staging # select only models in schema full name dbt.mart excluding staging dbterd run -ad samples/dbtresto -s schema:dbt.mart -ns model.dbt_resto.staging # other samples dbterd run -ad samples/fivetranlog dbterd run -ad samples/fivetranlog -rt model -rt source dbterd run -ad samples/facebookad dbterd run -ad samples/facebookad -rt model -rt source dbterd run -ad samples/shopify -s wildcard:*shopify.shopify__* dbterd run -ad samples/shopify -rt model -rt source dbterd run -ad samples/dbt-constraints -a "test_relationship:(name:foreign_key|c_from:fk_column_name|c_to:pk_column_name)" # your own sample without commiting to repo dbterd run -ad samples/local -rt model -rt source
-
Play with Python API (whole ERD):
from dbterd.api import DbtErd erd = DbtErd().get_erd() print("erd (dbml):", erd) erd = DbtErd(target="mermaid").get_erd() print("erd (mermaid):", erd)
-
Play with Python API (1 model's ERD):
from dbterd.api import DbtErd dim_prize_erd = DbtErd(target="mermaid").get_model_erd( node_unique_id="model.dbt_resto.dim_prize" ) print("erd of dim_prize (mermaid):", dim_prize_erd)
Here is the output:
erDiagram "MODEL.DBT_RESTO.DIM_PRIZE" { varchar prize_key nvarchar prize_name int prize_order } "MODEL.DBT_RESTO.FACT_RESULT" { varchar fact_result_key varchar box_key varchar prize_key date date_key int no_of_won float prize_value float prize_paid int is_prize_taken } "MODEL.DBT_RESTO.FACT_RESULT" }|--|| "MODEL.DBT_RESTO.DIM_PRIZE": prize_key
🏃Check out the Quick Demo with DBML!
Contributing ✨
If you've ever wanted to contribute to this tool, and a great cause, now is your chance!
See the contributing docs CONTRIBUTING for more information.
If you've found this tool to be very helpful, please consider giving the repository a star, sharing it on social media, or even writing a blog post about it 💌
Finally, super thanks to our Contributors:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dbterd-1.13.5.tar.gz.
File metadata
- Download URL: dbterd-1.13.5.tar.gz
- Upload date:
- Size: 30.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.5.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1499260400d04c26780b8f678c46837c22070204d5c06fbde05d6d1b1347171
|
|
| MD5 |
86152a5e54efb92b1679fbb73938e147
|
|
| BLAKE2b-256 |
3f7ad5d96acb99e5eee434d099552b6f4b54ef3cb5a37b6128b2f264b4e6a691
|
File details
Details for the file dbterd-1.13.5-py3-none-any.whl.
File metadata
- Download URL: dbterd-1.13.5-py3-none-any.whl
- Upload date:
- Size: 42.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.5.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bae145095b5aecbcfa13b103c55b2bff47211d3c9bdbe523060d3facaabbd1b
|
|
| MD5 |
08aa5008383cc77385422b00016dff4f
|
|
| BLAKE2b-256 |
1fe840501cc315efe2aa2902609cadb9d3c2f9c8d636ef2704fd150904136e2e
|