[Core] Explanation of the --empty
flag to support unit tests
#6051
Labels
content
Improvements or additions to content
dbt Core
The changes proposed in this issue relate to dbt Core
size: large
This change will more than a week to address and might require more than one person
Link to the page(s) on docs.getdbt.com requiring updates
Tell us more about this update
This content feels like it could be combined, simplified, and unified (potentially into a shared snippet).
As-is the pages for run and build are missing the same level of detail that is contained in the unit tests page.
Simultaneously, the unit tests page feels like it might have too much detail.
Reviewers/Stakeholders/SMEs
.
Related GitHub issues
dbt-labs/dbt-core#10695
Additional information
💡 The key insight
When you run dbt tests in a stand-alone fashion (e.g.,
dbt test
), it needs the database tables, views, etc. to exist in the database! Otherwise, it will give an error like "relation doesn't exist" 💥👉 So doing a
dbt run --empty
creates all the database objects in the dbt project in the most minimal way possible -- just the column headers + data types, but no rows. Building these objects with zero rows is faster and incurs less warehouse spend than building the entire data set.✅ Then after that, you're free to do
dbt test --select some_specific_test
as much as you want!The text was updated successfully, but these errors were encountered: