Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Only run a set of models?

Tags:

dbt

I started to migrate some of your transformations jobs to DBT. As you can see on the image bellow, there is usually 1 to 2 transformations before to have our final table (up to 5 transformations in some cases).

What I am trying to achieve is to do dbt run only for a set on linked model. For instance, sales_prediction and forecast. I am currently able to run either for everything with dbt run or just speficif model using dbt run --select model_name

enter image description here

like image 475
Pierre-Alexandre Avatar asked Sep 12 '25 21:09

Pierre-Alexandre


2 Answers

Dbt allows syntax of

  • selecting a node and all nodes it requires (+ before the model name)
  • selecting a node and all nodes that depend on it (+ after the model name)
  • you can also do both (+model_name+)

In your case dbt run --select +forecast should do the trick

Also check the documentation of the + operator.

like image 178
botchniaque Avatar answered Sep 15 '25 07:09

botchniaque


In addition to the + operator, incase you just need to run multiple unrelated models by specifying their names, you can do so as such:

dbt run --select my_first_model my_second_model
like image 42
Shankar ARUL Avatar answered Sep 15 '25 08:09

Shankar ARUL