Skip to main content

Graph operators

The "plus" operator

If 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.

$ dbt run --select my_model+          # select my_model and all children
$ dbt run --select +my_model # select my_model and all parents
$ dbt run --select +my_model+ # select my_model, and all of its parents and children

The "n-plus" operator

You can adjust the behavior of the + operator by quantifying the number of edges to step through.

$ dbt run --select my_model+1          # select my_model and its first-degree children
$ dbt run --select 2+my_model # select my_model, its first-degree parents, and its second-degree parents ("grandparents")
$ dbt run --select 3+my_model+4 # select my_model, its parents up to the 3rd degree, and its children down to the 4th degree

The "at" operator

The @ operator is similar to +, but will also include the parents of the children of the selected model. This is useful in continuous integration environments where you want to build a model and all of its children, but the parents of those children might not exist in the database yet. The selector @snowplow_web_page_context will build all three models shown in the diagram below.

@snowplow_web_page_context will select all of the models shown here@snowplow_web_page_context will select all of the models shown here
$ dbt run --models @my_model          # select my_model, its children, and the parents of its children