Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
dbt Labs · dbt Analytics Engineering

Commands and Node Selection

dbt Analytics Engineering · Lesson 4 of 17 · 21:25

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the dbt Analytics Engineering Certification exam. In this lesson: dbt build, run, and test, then seed, snapshot, show, and docs, selecting nodes by name, path, tag, and resource type, and graph operators, unions, intersections, and exclusions. Includes three original practice questions, with Orchardline Meal Kits, a fictional meal-kit company, as the example.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Tested too late, built too much

Orchardline's nightly job runs dbt run, then dbt test, and last week, duplicated orders reached the revenue mart before any test could stop them. Meanwhile, every developer rebuilds the whole project to check a single change. This lesson covers the main dbt commands, and the node selection syntax that runs exactly what you need.

Build, run, and test

dbt run builds models, and only models, in the order of the DAG. dbt test runs data tests on models, sources, seeds, and snapshots, and unit tests on SQL models, against resources that already exist. dbt build does all of it in one pass, in DAG order: it runs models, seeds, and snapshots, and it tests each resource right after building it. When a test fails, dbt build skips every resource downstream, so bad data never reaches the marts. And the full refresh flag makes run or build rebuild incremental models from scratch, as if they were tables.

Seed, snapshot, show, and docs

dbt seed loads small CSV files from the project's seeds folder into the warehouse as tables, for reference data kept under version control, like Orchardline's list of delivery regions. dbt snapshot runs the snapshots, which record how rows change over time, as lesson six explains. dbt show compiles a model or an inline query, runs it, and prints the first five rows by default, and it always runs the query, rather than reading the table already built. dbt docs generate builds the documentation site, and reads the warehouse, so that even undocumented columns appear. And dbt docs serve opens that site on your machine, with the lineage graph.

Selecting nodes

By default, dbt run builds every model in the project, and the select flag, or its short form, picks a subset. An argument can be a model name, a folder path, or a method followed by a colon, like tag, source, config, or test type. Arguments separated by spaces form a union, while arguments joined by a comma, with no space, form an intersection. The exclude flag then removes nodes from the selection. And put the selection in quotes, so that your shell passes it to dbt unchanged.

Graph operators

Graph operators extend a selection along the DAG. A plus sign after a model adds all of its descendants, and a plus sign before it adds all of its ancestors. A number limits the depth: a two before the plus sign adds parents and grandparents, and a one after a trailing plus sign adds only the direct children. The at sign, before a model, selects the model, its descendants, and every ancestor of those descendants, which helps in continuous integration, where a child needs its other parents too. And operators also work with methods, like a source or a tag followed by a plus sign.

Recap

Let's recap. dbt run builds models, dbt test runs tests, and dbt build does both in DAG order, skipping downstream nodes on a failure. dbt seed loads CSV files, dbt snapshot tracks changes, and dbt show previews rows. dbt docs generate builds the site, and dbt docs serve opens it. Spaces form a union, commas an intersection, and exclude removes nodes. Plus signs add ancestors or descendants, and the at sign adds the ancestors of the descendants too.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. Orchardline wants the nightly job to stop duplicated orders from ever reaching the revenue mart, with a single command. What should the job run?

    • dbt run, then dbt test
    • dbt test, then dbt run
    • dbt build
    • dbt run --full-refresh
    Show the answer

    dbt build

    Dbt build tests each model right after building it, and skips everything downstream when a test fails. “dbt run, then dbt test” is wrong, since the tests only start once every model, the revenue mart included, is already built. “dbt test, then dbt run” is wrong, since tests run before the models check yesterday's tables, not tonight's data. And “dbt run --full-refresh” is wrong, since a full refresh rebuilds incremental models, and runs no test at all.

  2. A developer wants to run only the models that are both in the marts finance folder and tagged hourly. Which selection does that?

    • --select "marts.finance tag:hourly"
    • --select "marts.finance,tag:hourly"
    • --select "marts.finance" --exclude "tag:hourly"
    • --select "tag:hourly+"
    Show the answer

    --select "marts.finance,tag:hourly"

    A comma with no space keeps only the nodes that match both arguments. “--select "marts.finance tag:hourly"” is wrong, since a space builds a union, every finance model plus every hourly model. “--select "marts.finance" --exclude "tag:hourly"” is wrong, since exclude removes the hourly models, the opposite of the goal. And “--select "tag:hourly+"” is wrong, since it selects every hourly model, in any folder, and everything downstream of them.

  3. A test job builds a changed staging model and its descendants. One descendant mart also joins a model from another branch, missing in the test schema. Which selection also builds that parent?

    • +stg_logistics__deliveries
    • stg_logistics__deliveries+
    • +stg_logistics__deliveries+
    • @stg_logistics__deliveries
    Show the answer

    @stg_logistics__deliveries

    The at sign adds the model, its descendants, and every ancestor of those descendants, including the other parent of the mart. “+stg_logistics__deliveries” is wrong, since it only builds the model and its own ancestors. “stg_logistics__deliveries+” is wrong, since it builds the descendants, but not their other parents. And “+stg_logistics__deliveries+” would only add the staging model's own ancestors, not those of the mart.