Search code examples
dbt

Only run a set of models?


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


Solution

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