Name | dbterd JSON |
Version |
1.21.0
JSON |
| download |
home_page | None |
Summary | Generate the ERD-as-a-code from dbt artifacts |
upload_time | 2025-10-20 10:36:05 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License
Copyright (c) 2022 Dat Nguyen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
|
keywords |
dbt
erd
entity-relationship-diagram
dbml
mermaid
plantuml
graphviz
d2
drawdb
data-modeling
data-documentation
dbt-cloud
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<div style="display: flex; align-items: center; justify-content: space-between;">
<div>
<h1 style="margin: 0;">dbterd</h1>
<p style="margin: 0; font-weight: bold;">Generate ERD-as-a-code from your dbt projects</p>
</div>
<img src="docs/assets/logo.svg" alt="dbterd logo" width="200" height="80">
</div>
Transform your dbt artifact files or metadata into stunning Entity Relationship Diagrams using multiple formats: DBML, Mermaid, PlantUML, GraphViz, D2, and DrawDB
[](https://dbterd.datnguyen.de/)
[](https://pypi.org/project/dbterd/)

[](https://opensource.org/licenses/MIT)
[](https://www.python.org)
[](https://codecov.io/gh/datnguye/dbterd)
[](https://github.com/datnguye/dbterd)
## ๐ฏ Entity Relationship Detection
dbterd intelligently detects entity relationships through:
- **๐งช [Test Relationships](https://docs.getdbt.com/reference/resource-properties/data-tests#relationships)** (default method)
- **๐๏ธ [Semantic Entities](https://docs.getdbt.com/docs/build/entities)** (use `-a` option)
For detailed configuration options, see our [CLI References](https://dbterd.datnguyen.de/latest/nav/guide/cli-references.html#dbterd-run-algo-a).
## ๐จ Supported Output Formats
| Format | Description | Use Case |
|--------|-------------|----------|
| **[DBML](https://dbdiagram.io/d)** | Database Markup Language | Interactive web diagrams |
| **[Mermaid](https://mermaid-js.github.io/mermaid-live-editor/)** | Markdown-friendly diagrams | Documentation, GitHub |
| **[PlantUML](https://plantuml.com/ie-diagram)** | Text-based UML | Technical documentation |
| **[GraphViz](https://graphviz.org/)** | DOT graph description | Complex relationship visualization |
| **[D2](https://d2lang.com/)** | Modern diagram scripting | Beautiful, customizable diagrams |
| **[DrawDB](https://drawdb.vercel.app/)** | Web-based database designer | Interactive database design |
๐ฏ **[Try the Quick Demo](https://dbterd.datnguyen.de/latest/nav/guide/targets/generate-dbml.html)** with DBML format!
## ๐ Installation
```bash
pip install dbterd --upgrade
```
Verify Installation:
```bash
dbterd --version
```
> [!TIP]
> **For dbt-core Users**: Upgrade `dbt-artifacts-parser` to support newer dbt-core versions:
> ```bash
> pip install dbt-artifacts-parser --upgrade
> ```
## ๐ก Examples
### CLI Examples
<details>
<summary>๐ฑ๏ธ <strong>Click to explore CLI examples</strong></summary>
```bash
# ๐ Select all models in dbt_resto
dbterd run -ad samples/dbtresto
# ๐ฏ Select multiple dbt resources (models + sources)
dbterd run -ad samples/dbtresto -rt model -rt source
# ๐ Select models excluding staging
dbterd run -ad samples/dbtresto -s model.dbt_resto -ns model.dbt_resto.staging
# ๐ Select by schema name
dbterd run -ad samples/dbtresto -s schema:mart -ns model.dbt_resto.staging
# ๐ท๏ธ Select by full schema name
dbterd run -ad samples/dbtresto -s schema:dbt.mart -ns model.dbt_resto.staging
# ๐ Other sample projects
dbterd run -ad samples/fivetranlog -rt model -rt source
dbterd run -ad samples/facebookad -rt model -rt source
dbterd run -ad samples/shopify -s wildcard:*shopify.shopify__*
# ๐ Custom relationship detection
dbterd run -ad samples/dbt-constraints -a "test_relationship:(name:foreign_key|c_from:fk_column_name|c_to:pk_column_name)"
# ๐ป Your local project
dbterd run -ad samples/local -rt model -rt source
```
</details>
### Python API Examples
**Generate Complete ERD**
```python
from dbterd.api import DbtErd
# Generate DBML format
erd = DbtErd().get_erd()
print("ERD (DBML):", erd)
# Generate Mermaid format
erd = DbtErd(target="mermaid").get_erd()
print("ERD (Mermaid):", erd)
```
**Generate Single Model ERD**
```python
from dbterd.api import DbtErd
# Get ERD for specific model
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)
```
**Sample Output:**
```mermaid
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
```
---
## ๐ค Contributing
We welcome contributions! ๐
**Ways to contribute:** ๐ Report bugs | ๐ก Suggest features | ๐ Improve documentation | ๐ง Submit pull requests
See our **[Contributing Guide](https://dbterd.datnguyen.de/latest/nav/development/contributing-guide.html)** for detailed information.
**Show your support:**
- โญ Star this repository
- ๐ข Share on social media
- โ๏ธ Write a blog post
- โ [Buy me a coffee](https://www.buymeacoffee.com/datnguye)
[](https://www.buymeacoffee.com/datnguye)
## ๐ฅ Contributors
A huge thanks to our amazing contributors! ๐
<a href="https://github.com/datnguye/dbterd/graphs/contributors">
<img src="https://contrib.rocks/image?repo=datnguye/dbterd" />
</a>
## ๐ง Support
**Need help?** We're here for you! Check ๐ [Documentation](https://dbterd.datnguyen.de/), ๐ [Report Issues](https://github.com/datnguye/dbterd/issues) and ๐ฌ [Discussions](https://github.com/datnguye/dbterd/discussions)
---
<div align="center">
**Made with โค๏ธ by the dbterd community**
---
### Sponsored by GitAds
[](https://gitads.dev/v1/ad-track?source=datnguye/dbterd@github)
<!-- GitAds-Verify: KHY1BVKH7W6UIGSKX7AOWMA6LBQH9FVS -->
</div>
Raw data
{
"_id": null,
"home_page": null,
"name": "dbterd",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Dat Nguyen <datnguye.it09@gmail.com>",
"keywords": "dbt, erd, entity-relationship-diagram, dbml, mermaid, plantuml, graphviz, d2, drawdb, data-modeling, data-documentation, dbt-cloud",
"author": null,
"author_email": "Dat Nguyen <datnguye.it09@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/03/64/1b1bfd0e5099e1c104fae5558b9e284d7e75801a87fa8ae3163280c39a90/dbterd-1.21.0.tar.gz",
"platform": null,
"description": "<div style=\"display: flex; align-items: center; justify-content: space-between;\">\n <div>\n <h1 style=\"margin: 0;\">dbterd</h1>\n <p style=\"margin: 0; font-weight: bold;\">Generate ERD-as-a-code from your dbt projects</p>\n </div>\n <img src=\"docs/assets/logo.svg\" alt=\"dbterd logo\" width=\"200\" height=\"80\">\n</div>\n\nTransform your dbt artifact files or metadata into stunning Entity Relationship Diagrams using multiple formats: DBML, Mermaid, PlantUML, GraphViz, D2, and DrawDB\n\n[](https://dbterd.datnguyen.de/)\n[](https://pypi.org/project/dbterd/)\n\n[](https://opensource.org/licenses/MIT)\n[](https://www.python.org)\n[](https://codecov.io/gh/datnguye/dbterd)\n\n[](https://github.com/datnguye/dbterd)\n\n## \ud83c\udfaf Entity Relationship Detection\n\ndbterd intelligently detects entity relationships through:\n\n- **\ud83e\uddea [Test Relationships](https://docs.getdbt.com/reference/resource-properties/data-tests#relationships)** (default method)\n- **\ud83c\udfdb\ufe0f [Semantic Entities](https://docs.getdbt.com/docs/build/entities)** (use `-a` option)\n\nFor detailed configuration options, see our [CLI References](https://dbterd.datnguyen.de/latest/nav/guide/cli-references.html#dbterd-run-algo-a).\n\n## \ud83c\udfa8 Supported Output Formats\n\n| Format | Description | Use Case |\n|--------|-------------|----------|\n| **[DBML](https://dbdiagram.io/d)** | Database Markup Language | Interactive web diagrams |\n| **[Mermaid](https://mermaid-js.github.io/mermaid-live-editor/)** | Markdown-friendly diagrams | Documentation, GitHub |\n| **[PlantUML](https://plantuml.com/ie-diagram)** | Text-based UML | Technical documentation |\n| **[GraphViz](https://graphviz.org/)** | DOT graph description | Complex relationship visualization |\n| **[D2](https://d2lang.com/)** | Modern diagram scripting | Beautiful, customizable diagrams |\n| **[DrawDB](https://drawdb.vercel.app/)** | Web-based database designer | Interactive database design |\n\n\ud83c\udfaf **[Try the Quick Demo](https://dbterd.datnguyen.de/latest/nav/guide/targets/generate-dbml.html)** with DBML format!\n\n## \ud83d\ude80 Installation\n\n```bash\npip install dbterd --upgrade\n```\n\nVerify Installation:\n\n```bash\ndbterd --version\n```\n\n> [!TIP]\n> **For dbt-core Users**: Upgrade `dbt-artifacts-parser` to support newer dbt-core versions:\n> ```bash\n> pip install dbt-artifacts-parser --upgrade\n> ```\n\n## \ud83d\udca1 Examples\n\n### CLI Examples\n\n<details>\n<summary>\ud83d\uddb1\ufe0f <strong>Click to explore CLI examples</strong></summary>\n\n```bash\n# \ud83d\udcca Select all models in dbt_resto\ndbterd run -ad samples/dbtresto\n\n# \ud83c\udfaf Select multiple dbt resources (models + sources)\ndbterd run -ad samples/dbtresto -rt model -rt source\n\n# \ud83d\udd0d Select models excluding staging\ndbterd run -ad samples/dbtresto -s model.dbt_resto -ns model.dbt_resto.staging\n\n# \ud83d\udccb Select by schema name\ndbterd run -ad samples/dbtresto -s schema:mart -ns model.dbt_resto.staging\n\n# \ud83c\udff7\ufe0f Select by full schema name\ndbterd run -ad samples/dbtresto -s schema:dbt.mart -ns model.dbt_resto.staging\n\n# \ud83c\udf1f Other sample projects\ndbterd run -ad samples/fivetranlog -rt model -rt source\ndbterd run -ad samples/facebookad -rt model -rt source\ndbterd run -ad samples/shopify -s wildcard:*shopify.shopify__*\n\n# \ud83d\udd17 Custom relationship detection\ndbterd run -ad samples/dbt-constraints -a \"test_relationship:(name:foreign_key|c_from:fk_column_name|c_to:pk_column_name)\"\n\n# \ud83d\udcbb Your local project\ndbterd run -ad samples/local -rt model -rt source\n```\n\n</details>\n\n### Python API Examples\n\n**Generate Complete ERD**\n\n```python\nfrom dbterd.api import DbtErd\n\n# Generate DBML format\nerd = DbtErd().get_erd()\nprint(\"ERD (DBML):\", erd)\n\n# Generate Mermaid format\nerd = DbtErd(target=\"mermaid\").get_erd()\nprint(\"ERD (Mermaid):\", erd)\n```\n\n**Generate Single Model ERD**\n\n```python\nfrom dbterd.api import DbtErd\n\n# Get ERD for specific model\ndim_prize_erd = DbtErd(target=\"mermaid\").get_model_erd(\n node_unique_id=\"model.dbt_resto.dim_prize\"\n)\nprint(\"ERD of dim_prize (Mermaid):\", dim_prize_erd)\n```\n\n**Sample Output:**\n\n```mermaid\nerDiagram\n \"MODEL.DBT_RESTO.DIM_PRIZE\" {\n varchar prize_key\n nvarchar prize_name\n int prize_order\n }\n \"MODEL.DBT_RESTO.FACT_RESULT\" {\n varchar fact_result_key\n varchar box_key\n varchar prize_key\n date date_key\n int no_of_won\n float prize_value\n float prize_paid\n int is_prize_taken\n }\n \"MODEL.DBT_RESTO.FACT_RESULT\" }|--|| \"MODEL.DBT_RESTO.DIM_PRIZE\": prize_key\n```\n\n---\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! \ud83c\udf89\n\n**Ways to contribute:** \ud83d\udc1b Report bugs | \ud83d\udca1 Suggest features | \ud83d\udcdd Improve documentation | \ud83d\udd27 Submit pull requests\n\nSee our **[Contributing Guide](https://dbterd.datnguyen.de/latest/nav/development/contributing-guide.html)** for detailed information.\n\n**Show your support:**\n- \u2b50 Star this repository\n- \ud83d\udce2 Share on social media\n- \u270d\ufe0f Write a blog post\n- \u2615 [Buy me a coffee](https://www.buymeacoffee.com/datnguye)\n\n[](https://www.buymeacoffee.com/datnguye)\n\n## \ud83d\udc65 Contributors\n\nA huge thanks to our amazing contributors! \ud83d\ude4f\n\n<a href=\"https://github.com/datnguye/dbterd/graphs/contributors\">\n <img src=\"https://contrib.rocks/image?repo=datnguye/dbterd\" />\n</a>\n\n## \ud83d\udce7 Support\n\n**Need help?** We're here for you! Check \ud83d\udcd6 [Documentation](https://dbterd.datnguyen.de/), \ud83d\udc1b [Report Issues](https://github.com/datnguye/dbterd/issues) and \ud83d\udcac [Discussions](https://github.com/datnguye/dbterd/discussions)\n\n---\n\n<div align=\"center\">\n\n**Made with \u2764\ufe0f by the dbterd community**\n\n---\n\n### Sponsored by GitAds\n[](https://gitads.dev/v1/ad-track?source=datnguye/dbterd@github)\n\n<!-- GitAds-Verify: KHY1BVKH7W6UIGSKX7AOWMA6LBQH9FVS -->\n\n</div>\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2022 Dat Nguyen\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n ",
"summary": "Generate the ERD-as-a-code from dbt artifacts",
"version": "1.21.0",
"project_urls": {
"Documentation": "https://dbterd.datnguyen.de/",
"Homepage": "https://github.com/datnguye/dbterd",
"Issues": "https://github.com/datnguye/dbterd/issues",
"Repository": "https://github.com/datnguye/dbterd"
},
"split_keywords": [
"dbt",
" erd",
" entity-relationship-diagram",
" dbml",
" mermaid",
" plantuml",
" graphviz",
" d2",
" drawdb",
" data-modeling",
" data-documentation",
" dbt-cloud"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "7284107682417ef0885ff7dc9249b81f77f4b0f76e8f7b3672c38e27f7952a42",
"md5": "0da4b0cbba08a293c997376146bb6824",
"sha256": "5daf8064b7b256ba1a5213da6ef726fd337c3819fbd36170873f23488b85f115"
},
"downloads": -1,
"filename": "dbterd-1.21.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0da4b0cbba08a293c997376146bb6824",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 48579,
"upload_time": "2025-10-20T10:36:03",
"upload_time_iso_8601": "2025-10-20T10:36:03.857494Z",
"url": "https://files.pythonhosted.org/packages/72/84/107682417ef0885ff7dc9249b81f77f4b0f76e8f7b3672c38e27f7952a42/dbterd-1.21.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "03641b1bfd0e5099e1c104fae5558b9e284d7e75801a87fa8ae3163280c39a90",
"md5": "c04e0709dda96531f126657cc42cd113",
"sha256": "827c664e8502536f7cb0393614b6b65f6945326393a4b96f295a47b95e39eab8"
},
"downloads": -1,
"filename": "dbterd-1.21.0.tar.gz",
"has_sig": false,
"md5_digest": "c04e0709dda96531f126657cc42cd113",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 38290,
"upload_time": "2025-10-20T10:36:05",
"upload_time_iso_8601": "2025-10-20T10:36:05.170233Z",
"url": "https://files.pythonhosted.org/packages/03/64/1b1bfd0e5099e1c104fae5558b9e284d7e75801a87fa8ae3163280c39a90/dbterd-1.21.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-20 10:36:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "datnguye",
"github_project": "dbterd",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "dbterd"
}