Datacoves logo

Ultimate dbt Cheat Sheet

ByNoel Gomez 9 mins read
Dbt cheat sheet
Key Summary

A quick, updated reference for dbt 1.8 commands, graph operators, selectors, and CLI flags — plus how Datacoves simplifies the dbt Core experience.

You now know what dbt (data build tool) is all about.  You are being productive, but you forgot what `dbt build` does or you forgot what the @ dbt graph operator does. This handy dbt cheat sheet has it all in one place.

dbt cheat sheet - Updated for dbt 1.8

With the advent of dbt 1.6, we updated the awesome dbt cheat sheet created originally by Bruno de Lima

We have also moved the dbt jinja sheet to a dedicated post.

This reference summarizes all the dbt commands you may need as you run your dbt jobs or study for your dbt certification.

If you ever wanted to know what the difference between +model and @model is in your dbt run, you will find the answer. Whether you are trying to understand dbt graph operators or what the dbt retry command does, but this cheat sheet has you covered. Check it out below.

Primary dbt commands

These are the principal commands you will use most frequently with dbt. Not all of these will be available on dbt Cloud

dbt Command arguments

The dbt commands above have options that allow you to select and exclude models as well as deferring to another environment like production instead of building dependent models for a given run. This table shows which options are available for each dbt command

dbt selectors

By combining the arguments above like "-s" with the options below, you can tell dbt which items you want to select or exclude. This can be a specific dbt model, everything in a specific folder, or now with the latest versions of dbt, the specific version of a model you are interested in.

dbt node selectors
tag Select models that match a specified tag
source Select models that select from a specified source
path Select models/sources defined at or under a specific path.
file / fqn Used to select a model by its filename, including the file extension (.sql).
package Select models defined within the root project or an installed dbt package.
config Select models that match a specified node config.
test_type Select tests based on their type, singular or generic, data, or unit (unit tests are available only in dbt 1.8)
test_name Select tests based on the name of the generic test that defines it.
state Select nodes by comparing them against a previous version of the same project, which is represented by a manifest. The file path of the comparison manifest must be specified via the --state flag or DBT_STATE environment variable.
exposure Select parent resources of a specified exposure.
metric Select parent resources of a specified metric.
result The result method is related to the state method described above and can be used to select resources based on their result status from a prior run.
source_status Select resource based on source freshness
group Select models defined within a group
access Selects models based on their access property.
version Selects versioned models based on their version identifier and latest version.

dbt graph operators

dbt Graph Operator provide a powerful syntax that allow you to hone in on the specific items you want dbt to process.

dbt graph operators
+ If "plus" (+) operator is placed at the front of the model selector, + will select all parents of the selected model. If placed at the end of the string, + will select all children of the selected model.
n+ With the n-plus (n+) operator you can adjust the behavior of the + operator by quantifying the number of edges to step through.
@ The "at" (@) operator is similar to +, but will also include the parents of the children of the selected model.
* The "star" (*) operator matches all models within a package or directory.

Project level dbt commands

The following commands are used less frequently and perform actions like initializing a dbt project, installing dependencies, or validating that you can connect to your database.

dbt command line (CLI) flags

The flags below immediately follow the dbt command and go before the subcommand e.g. dbt <FLAG> run

Read the official dbt documentation

dbt command line (CLI) flags (general)
-x, --fail-fast / --no-fail-fast Stop dbt execution as soon as a failure occurs.
-h, --help Shows command help documentation
--send-anonymous-usage-stats / --no-send-anonymous-usage-stats Send anonymous dbt usage statistics to dbt Labs.
-V, -v, --version Returns information about the installed dbt version
--version-check / --no-version-check Ensures or ignores that the installed dbt version matches the require-dbt-version specified in the dbt_project.yml file.
--warn-error If dbt would normally warn, instead raise an exception.
--warn-error-options WARN_ERROR_OPTIONS Allows for granular control over exactly which types of warnings are treated as errors. This argument receives a YAML string like '{"include": "all"}.
--write-json / --no-write-json Whether or not to write the manifest.json and run_results.json files to the target directory

‍

dbt CLI flags (logging and debugging)
-d, --debug / --no-debug Display debug logging during dbt execution useful for debugging and making bug reports. Not to be confused with the dbt debug command which tests database connection.
--log-cache-events / --no-log-cache-events Enable verbose logging for relational cache events to help when debugging.
--log-format [text|debug|json|default] Specify the format of logging to the console and the log file.
--log-format-file [text|debug|json|default] Specify the format of logging to the log file by overriding the default format
--log-level [debug|info|warn|error|none] Specify the severity of events that are logged to the console and the log file.
--log-level-file [debug|info|warn|error|none] Specify the severity of events that are logged to the log file by overriding the default log level
--log-path PATH Configure the 'log-path'. Overrides 'DBT_LOG_PATH' if it is set.
--print / --no-print Outputs or hides all {{ print() }} statements within a macro call.
--printer-width INTEGER Sets the number of characters for terminal output
-q, --quiet / --no-quiet Suppress all non-error logging to stdout Does not affect {{ print() }} macro calls.
--use-colors / --no-use-colors Specify whether log output is colorized in the terminal
--use-colors-file / --no-use-colors-file Specify whether log file output is colorized

‍

dbt CLI flags (parsing and performance)
--cache-selected-only / --no-cache-selected-only Have dbt cache or not cache metadata about all the objects in all the schemas where it might materialize resources
--partial-parse / --no-partial-parse Uses or ignores the pickle file in the target folder used to speed up dbt invocations by only reading and parsing modified objects.
--populate-cache / --no-populate-cache At start of run, use `show` or `information_schema` queries to populate a relational cache to speed up subsequent materializations
-r, --record-timing-info PATH Saves performance profiling information to a file that can be visualized with snakeviz to understand the performance of a dbt invocation
--static-parser / --no-static-parser Use or disable the static parser. (e.g. no partial parsing if enabled)
--use-experimental-parser / --no-use-experimental-parser Enable experimental parsing features.

As a managed dbt Core solution, the Datacoves platform simplifies the dbt Core experience and retains its inherent flexibility. It effectively bridges the gap, capturing many benefits of dbt Cloud while mitigating the challenges tied to a pure dbt Core setup. See if Datacoves dbt pricing is right for your organization or visit our product page.

Please contact us with any errors or suggestions.

FAQ

How do dbt seeds work and when should I use them?

+

dbt seed loads CSV files stored in your seeds/ folder into your data warehouse as tables. Seeds are best for small, static reference datasets. For example,  country codes, territory mappings, or status lookup tables.Seeds are not suitable for large datasets. Run dbt seed to load them, and reference them in models using ref() just like any other model.Note that the CSV files for seeds are part of your dbt project and are committed to git, so you would not use a seed to load data that gets refreshed on a regular basis.

How do I run only a specific dbt model without running the whole project?

+

Use the --select or -s flag with the model name: dbt run --select my_model.
You can also target models
* by folder path (dbt run --s models/staging)
* by tag (dbt run --s tag:daily)
* by file path (dbt run --s path/to/some_model.sql)

To preview which models will be selected without running them, use dbt ls --select my_model first.

What does dbt retry do and when should I use it?

+

dbt retry re-executes the last dbt command starting from the point of failure. It reads run_results.json to determine which node failed and picks up from there. This is useful in CI/CD pipelines or long production runs where a transient error caused a mid-run failure and you do not want to rebuild models that already succeeded. Note, the run_results.json of the prior run must be availeble for dbt to know where to resume execution.

What does the --full-refresh flag do and when is it needed?

+

The --full-refresh flag forces dbt to drop and recreate incremental models from scratch instead of appending or updating records. Use it when the logic of an incremental model has changed, when the schema has been altered, or when you need to reprocess historical data. Without it, incremental models only process new or updated records since the last run.

What does the + graph operator do in dbt?

+

The + operator selects upstream or downstream models relative to a target model. Placing + before a model name (e.g., +my_model) selects the model and all its upstream dependencies. Placing it after (e.g., my_model+) selects the model and all downstream dependents. You can use both (e.g., +my_model+) to select everything connected to a model in both directions.

What is the difference between dbt Core and dbt Cloud, and where does Datacoves fit?

+

dbt Core is the open-source engine. It gives you full control but requires you to build and manage your own environment ‚ CI/CD, orchestration, secrets management, and infrastructure. dbt Cloud is a hosted SaaS platform from dbt Labs with a managed IDE and scheduler, but it limits flexibility, restricts private cloud deployment, and can be expensive at scale. Datacoves is a managed dbt Core alternative that delivers the usability of dbt Cloud without the trade-offs: it runs in your private cloud, integrates with Airflow, VS Code, and your existing tools, and includes pre-built CI/CD and best-practice guardrails out of the box.

What is the difference between dbt run and dbt build?

+

dbt run executes only your SQL models. dbt build does everything: it loads seeds, runs snapshots, executes models, and runs tests, as well as user defined functions(UDFs) in dbt 1.11+. For production pipelines and CI/CD, dbt build is the right choice. Use dbt run during active development when you want to iterate quickly on a single model without triggering the full test suite.

‍

What is the difference between dbt test and dbt build when it comes to testing?

+

dbt test runs all tests defined in your project but does not execute models. dbt build runs models and immediately tests them after each node in DAG order. If a test fails on an upstream model, downstream models are skipped entirely. For development, dbt test gives you faster feedback on a specific model. For production, dbt build ensures tests gate downstream execution.

What is the @ graph operator and when should I use it?

+

The @ operator is like + but more thorough. It selects a model, all its downstream dependents, and all the upstream dependencies of those downstream models. Use it when you need to ensure the complete, self-contained subgraph is rebuilt. For example, when testing a change that affects multiple downstream pipelines and you want every dependency refreshed.

What is the purpose of dbt snapshot and when does it apply?

+

dbt snapshot captures the state of a source table at a point in time and tracks how it changes over time. It is similar to a Type 2 Slowly Changing Dimension (SCD2). It records when a record was added, modified, or removed. Use snapshots when you need historical tracking of records that get updated in place in the source system, such as customer status or order state changes.

Last updated onJanuary 29, 2025

Get our free ebook dbt Cloud vs dbt Core

Comparing dbt Core and dbt Cloud? Download our eBook for insights on feature, pricing and total cost. Find the best fit for your business!

Get the PDF
Get free ebook dbt cloud
Noel Gomez
Noel Gomez
Author

Datacoves Co-founder | 15+ Years Data Platform Expert. Solving enterprise data challenges quickly with dbt & Airflow.

Continue reading

Seamless data analytics with managed dbt and Airflow

Don’t let platform limitations or maintenance overhead hold you back.

Noel gomez

Subscribe to our newsletter & be a part of our Exclusive Crew!

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Datacoves Logo

Datacoves is an enterprise DataOps platform with managed dbt Core and Airflow for data transformation and orchestration, as well as VS Code in the browser for development

LinkedIn X YouTube
Datacoves is snowflake ready technology badge
© 2026 Datacoves. All rights reserved.
Privacy Policy Terms of Service Sitemap

Apache, Apache Airflow, Airflow, Apache Superset, the Airflow logo, the Apache feather logo, Superset, and the Superset logo are trademarks of the Apache Software Foundation. Dbt, dbt core, dbt logo are trademarks of the dbt Labs, Inc. Airbyte, Airbyte logo are trademarks of the Airbyte, Inc. Snowflake, Snowflake logo are trademarks of the Snowflake Inc.