Graph Operators
Last updated
Was this helpful?
Last updated
Was this helpful?
Graph operators in dbt are special syntax used with the --select
flag to target specific parts of your project's execution graph (DAG). This graph represents the dependencies between your models, with each model as a node and the dependencies as edges.
The graph operators allow you to navigate this execution graph and select subsets of your project's resources. They're like secret codes to tell dbt exactly which models you want to work with, whether it's running, testing, or listing them.
*
)Run all models in a schema.
dbt run --select my_schema.*
No special character needed, just use the path.
dbt run --select models/staging
+
)The plus before a model name selects the model and its parents. The plus after a model name selects the model and its children.
dbt run --select +final_model
dbt run --select parent_model+
@
)Select parents or children, without the original model.
dbt run --select @model_name
dbt run --select model_name@
,
)Run multiple models.
dbt run --select model1,model2,model3
,
)Get the intersection of multiple selectors.
dbt run --select tag:nightly,staging.*
Combine operators for laser-focused selection:
dbt run --select tag:nightly,+final_model
Use dbt ls
to preview your selection:
dbt ls --select tag:nightly,+final_model
Refresh two generations of parents and all children of critical models:
dbt run --select +2tag:critical+
Test everything related to final reports except the reports themselves:
dbt test --select @tag:final_report@
Remember, the order of operators matters, as dbt processes them from left to right.
With these graph operators, you can create powerful, precise dbt commands to execute exactly the models you need in your data transformation pipelines.