Skip to content

5.3 Step 1: Import from dbt

Build the dbt artifacts

qdbd reads what dbt already writes to target/:

dbt build                 # or dbt parse; models need to exist for types
dbt docs generate         # writes catalog.json: real column types

manifest.json gives qdbd the models, columns, descriptions and tests. catalog.json is optional but adds column types.

Generate the schema

qdbd import dbt target/ -o erd/
Wrote erd/ (3 files): 8 tables, 1 relationships

With a directory as -o, qdbd writes one file per dbt folder:

erd/
├── models.txt     customers, orders
├── seeds.txt      raw_customers, raw_orders, raw_payments
└── staging.txt    stg_customers, stg_orders, stg_payments

Here's part of models.txt. It's plain QuickDBD syntax, so you can read it, diff it, and paste it into QuickDBD:

# Generated by qdbd import dbt from manifest.json (project jaffle_shop).
# Re-run the import to refresh; manual edits will be overwritten.

# This table has basic information about orders, as well as some derived facts based on payments
orders
-
# This is a unique identifier for an order
order_id PK INTEGER
# Foreign key to the customers table
customer_id INTEGER FK >- customers.customer_id
# Date (UTC) that the order was placed
order_date DATE
...

Where each part came from

In the diagram From dbt
orders table models/orders.sql
order_id PK unique + not_null tests on order_id
customer_id … FK >- customers.customer_id the relationships test in schema.yml
INTEGER, DATE catalog.json
# This is a unique identifier… the column description

No relationship lines?

qdbd draws the relationships your project declares: relationships tests (including dbt_utils relationships_where) or foreign_key constraints. Add --infer-fks to also link customer_id-style columns to the table they name; on jaffle_shop that adds 3 more (stg_orders → stg_customers, stg_payments → stg_orders, raw_payments → raw_orders). See 5.1 dbt Import.

Commit it

Commit erd/ with your dbt project. When models change, re-run the import; the files are regenerated and stale ones removed. Table positions live in erd/qdbd.layout.json (next step) and survive re-imports.

Next: explore the model :octicons-arrow-right-24: