Skip to content

dbterd

CLI to generate Diagram-as-a-code file (DBML, Mermaid, PlantUML, GraphViz, D2) from dbt artifact files (required: dbt dbt)

PyPI version python-cli License: MIT python codecov

pip install dbterd --upgrade Successfully installed dbterd restart ↻

Verify installed version:

dbterd --version

Quick examine with existing samples

# select all models in dbt_resto
dbterd run -ad samples/dbtresto -o target
# select all models in dbt_resto, Select multiple dbt resources
dbterd run -ad samples/dbtresto -o target -rt model -rt source
# select only models in dbt_resto excluding staging
dbterd run -ad samples/dbtresto -o target -s model.dbt_resto -ns model.dbt_resto.staging
# select only models in schema name mart excluding staging
dbterd run -ad samples/dbtresto -o target -s schema:mart -ns model.dbt_resto.staging
# select only models in schema full name dbt.mart excluding staging
dbterd run -ad samples/dbtresto -o target -s schema:dbt.mart -ns model.dbt_resto.staging

# other samples
dbterd run -ad samples/fivetranlog -o target
dbterd run -ad samples/fivetranlog -o target -rt model -rt source

dbterd run -ad samples/facebookad -o target
dbterd run -ad samples/facebookad -o target -rt model -rt source

dbterd run -ad samples/shopify -o target
dbterd run -ad samples/shopify -o target -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 -o target -rt model -rt source

Quick DEMO

Check Quick Demo out! And, following is the sample result using dbdocs:

screencapture-dbdocs-io-datnguye-poc-2023-02-25-10_29_32.png

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.

Finally, super thanks to our Contributors: