Skip to content

Transform & Model

Run dbt transformations, manage models, snapshots, and dev workflows from the CLI.


Overview

Transform your raw data into analytics-ready models using dbt, manage custom models, capture change history with snapshots, and iterate safely with the dev workflow.

Commands covered on this page:

  • dango run — Run dbt models
  • dango generate — Generate staging models
  • dango docs — Generate dbt documentation
  • dango model add/remove — Create or remove custom models
  • dango dev / dango dev clean — Development workflow
  • dango snapshot add/list/run/db — SCD Type 2 snapshots and DuckDB snapshots

Running Transformations

dango run

Run dbt models and tests. Wraps dbt build — all dbt arguments are passed through.

dango run [DBT_ARGS]...

This command works from anywhere within your project directory — it automatically finds the dbt project.

Examples:

# Run all models
dango run

# Run a specific model
dango run --select my_model

# Run model and all downstream dependents
dango run --select my_model+

# Run model and all upstream dependencies
dango run --select +my_model

# Run all models in a directory
dango run --select marts.*

# Run models by tag
dango run --select tag:daily

# Full refresh of incremental models
dango run --full-refresh

# Exclude specific models
dango run --exclude staging.*

Any dbt build option is supported — see dbt build --help for the complete list.

Tip

Run dango sync before dango run to ensure your raw data is up to date.


dango generate

Generate dbt staging models and schema definitions from data in DuckDB.

dango generate [OPTIONS]
Option Description
--models Generate staging models only (stg_*.sql files with deduplication logic)
--all Generate all artifacts (models + schema.yml with tests and documentation)
dango generate --models     # Staging SQL files only
dango generate --all        # Models + schema definitions

Tip

Run dango sync first to load data into DuckDB. The generator introspects existing tables to create models.


dango docs

Generate dbt documentation.

dango docs

After generation, view docs at http://localhost:<port>/catalog if the platform is running.


Model Management

dango model add

Create a new dbt model (intermediate or marts layer) via interactive wizard.

dango model add

The wizard helps you create:

  • Intermediate models — Reusable business logic that combines staging models
  • Marts models — Final business metrics for dashboards and reporting

Info

Staging models are auto-generated by dango generate. This wizard only handles intermediate and marts layers.


dango model remove

Remove a custom dbt model and cascade cleanup.

dango model remove MODEL_NAME [OPTIONS]
Parameter Type Description
MODEL_NAME positional, required Name of the model to remove
-y, --yes flag Skip confirmation prompt
--dry-run flag Show what would be removed without executing

Removes the model SQL file, schema.yml entry, monitors.yml references, and optionally drops the DuckDB table and refreshes Metabase schema.

dango model remove fct_daily_sales
dango model remove int_orders --yes
dango model remove fct_daily_sales --dry-run

Warning

Without --dry-run, this permanently removes the model file and its schema entries. Use --dry-run first to review what will be deleted.


Dev Workflow

dango dev

Run dbt against a copy of the production database. The production database is never modified.

dango dev [OPTIONS]
Option Description
-s, --select TEXT dbt model selection (e.g. stg_*, my_model+)
--diff Show row-count comparison after run

How it works:

  1. Copies data/warehouse.duckdb to .dango/dev/warehouse_dev.duckdb
  2. Runs dbt against the copy
  3. Shows results (and optionally a row-count diff)

The dev database persists after the run so you can inspect it with DuckDB tools.

# Run all models against dev copy
dango dev

# Run specific model(s)
dango dev -s stg_orders

# Show row-count diff after run
dango dev --diff

Tip

Use dango dev to test model changes before running them against production. The --diff flag shows exactly what changed.


dango dev clean

Remove the dev database and related artifacts.

dango dev clean

Deletes the .dango/dev/ directory created by dango dev.


Snapshots

dbt snapshots capture SCD Type 2 change history — tracking how rows change over time. Dango also provides DuckDB-level snapshots for notebook use.

dango snapshot add

Interactive wizard to create a dbt snapshot (SCD Type 2).

dango snapshot add

The wizard walks through:

  1. Selecting a source table
  2. Detecting the primary key
  3. Choosing a snapshot strategy
  4. Generating the snapshot SQL file

dango snapshot list

List configured dbt snapshots.

dango snapshot list

dango snapshot run

Execute dbt snapshot to capture SCD Type 2 change history.

dango snapshot run [OPTIONS]
Option Description
-s, --select TEXT Run specific snapshot(s) by name
# Run all snapshots
dango snapshot run

# Run a specific snapshot
dango snapshot run -s snap_shopify_orders

This acquires a DuckDB write lock before running dbt snapshot.


dango snapshot db

Create a DuckDB read-only snapshot for notebook use.

dango snapshot db [OPTIONS]
Option Description
-u, --user TEXT Username for the snapshot

Creates a copy of the warehouse database that notebooks can read without blocking writes.


Common Workflows

Iterating on a Model

# Edit your model SQL
vim dbt/models/marts/fct_daily_sales.sql

# Test against dev copy first
dango dev -s fct_daily_sales --diff

# Happy with results? Run against production
dango run --select fct_daily_sales

Adding a New Model

# Use the wizard
dango model add

# Or create manually, then run
dango run --select my_new_model

# Refresh Metabase to see new table
dango metabase refresh

Full Pipeline

# Sync data, generate staging, run all models
dango sync && dango generate --all && dango run

Troubleshooting

dbt model compilation error

Check the SQL syntax in your model file. Run dango run --select my_model to see the specific error. Ensure referenced models exist with dango run --select +my_model to include upstream dependencies.

Model not showing in Metabase

Run dango metabase refresh to trigger a schema sync. New schemas (e.g., marts) need to be discovered by Metabase before tables appear.

Dev database is stale

Run dango dev clean to remove the old copy, then dango dev to create a fresh copy from production.

Snapshot fails with write lock

Another process may be writing to DuckDB. Wait for active syncs to complete, or check dango status for running operations.