Generate DBML¶
1. Produce your manifest json¶
In your dbt project (I am using dbt-resto/integration_tests for demo purpose), try to build the docs:
dbt docs generate 01:40:58 Running with dbt=1.3.4 01:40:58 Partial parse save file not found. Starting full parse. 01:41:00 Found 0 models, 0 tests, 0 snapshots, 0 analyses, 356 macros, 1 operation, 0 seed files, 0 sources, 0 exposures, 0 metrics 01:41:00 01:41:00 Concurrency: 4 threads (target='postgres') 01:41:00 01:41:00 Done. 01:41:00 Building catalog 01:41:00 Catalog written to .\target\catalog.json
2. Generate DBML¶
Copy manifest.json
and catalog.json
into a specific folder OR do nothing and let's assume we're using dbt/target
directory, and run
Sample Usage
dbterd run -ad "/path/to/dbt/target" -o "/path/to/output"
dbterd run -ad "samples/dbtresto" -s model.dbt_resto 2023-05-06 08:17:54,413 - dbterd - INFO - Run with dbterd==?.?.? (main.py:54) 2023-05-06 08:17:54,715 - dbterd - INFO - target/output.dbml (base.py:75)
File ./target/output.dbml
will be generated as the result
3. Build database docs site (Optional)¶
Assuming you're already familiar with dbdocs
Sample Usage
dbdocs build "/path/to/output/output.dbml"
dbdocs build "./target/output.dbml" √ Parsing file content ? Project name: poc ‼ Password is not set for 'poc' √ Done. Visit: https://dbdocs.io/datnguye/poc
The site will be looks like:
Result after applied Model Selection: