CLI Reference (dbterd)¶
Run dbterd --help
or dbterd -h
to see the basic guideline for CLI Reference
Tools for producing diagram-as-code
Options:
--version Show the version and exit.
-h, --help Show this message and exit.
Commands:
debug Inspect the hidden magics
run Run the convert
run¶
Command to generate diagram-as-a-code file
Examples:
Usage: dbterd run [OPTIONS]
Run the convert
Options:
-ad, --artifacts-dir TEXT Specified the full path to dbt artifacts path
which known as /target directory [default:
C:\Users\DAT\Documents\Sources\dbterd\target]
-o, --output TEXT Output the result file. Default to the same
target dir [default:
C:\Users\DAT\Documents\Sources\dbterd\target]
-s, --select TEXT Selecttion criteria
-ns, --exclude TEXT Exclusion criteria
-t, --target TEXT Target to the diagram-as-code platform
[default: dbml]
-a, --algo TEXT Specified algorithm in the way to detect
diagram connectors [default:
test_relationship]
-mv, --manifest-version TEXT Specified dbt manifest.json version
-rt, --resource-type TEXT Specified dbt resource type(seed, model,
source, snapshot),default:model, use examples,
-rt model -rt source
-h, --help Show this message and exit.
--artifacts-dir (-ad)¶
Configure the path to directory containing dbt artifact files.
Default to
./target
Examples:
--output (-o)¶
Configure the path to directory containing the output diagram file.
Default to
./target
Examples:
--select (-s)¶
Selection criteria.
Select all dbt models if not specified, supports mulitple options
Rules:
- By
name
: model name starts with input string - By
schema
: schema name starts with an input string, formed asschema:<your_schema_name>
- By
wildcard
: model name matches to a wildcard pattern, formed aswildcard:<your_wildcard>
Examples:
AND
and OR
logic¶
AND
logic is applied to a single selection splitted by comma (,)OR
logic is applied to 2+ selection
Examples:
--exclude (-ns)¶
Exclusion criteria. Rules are the same as Selection Criteria.
Do not exclude any dbt models if not specified, supports mulitple options
Examples:
--target (-t)¶
Target to the diagram-as-code platform
Default to
dbml
Supports:
Examples:
--algo (-a)¶
Specified algorithm in the way to detect diagram connectors
Default to
test_relationship
In the advanced use case, the test name can be configurable by following syntax:
{algorithm_name}:(name:{contains_test_name}|c_from:{referencing_column_name}|c_to:{referenced_column_name})
In the above:
algorithm_name
:test_relationship
(only supported value now)contains_test_name
: Configure the test name (detected withcontains
logic). Default torelationship
c_from
: Configure the test metadata attribute (1) for the foreign key column name(s). If (1)'s value is multiple columns, it will concat them all with_and
wording > NOTE: It always looking at thecolumn_name
attribute firstlyc_to
: Configure the test metadata attribute (2) for the referenced column name(s). If (2)'s value is multiple columns, it will concat them all with_and
wording. Default tofield
Examples:
--manifest-version (-mv)¶
Specified dbt manifest.json version
Auto detect if not specified
Examples:
--resource-type (-rt)¶
Specified dbt resource type(seed, model, source, snapshot).
Default to
["model"]
, supports mulitple options
Examples:
debug¶
Shows hidden configured values
Examples:
2023-04-08 10:15:03,611 - dbterd - INFO - Run with dbterd==0.2.0 (main.py:43)
2023-04-08 10:15:03,612 - dbterd - INFO - **Arguments used** (main.py:52)
2023-04-08 10:15:03,613 - dbterd - DEBUG - {
"artifacts_dir": "C:\\Users\\DAT\\Documents\\Sources\\dbterd\\target",
"manifest_path": null,
"output": "C:\\Users\\DAT\\Documents\\Sources\\dbterd\\target",
"select": null,
"exclude": null,
"target": "dbml",
"algo": "test_relationship",
"manifest_version": null,
"resource_type": [
"model"
]
} (main.py:53)
2023-04-08 10:15:03,614 - dbterd - INFO - **Context used** (main.py:54)
2023-04-08 10:15:03,614 - dbterd - DEBUG - {} (main.py:55)