How do you run models in a path?

#1 states

The --models flag accepts one or more arguments. Each argument can be one of:
3. a path hierarchy to a models directory

dbt run --models # runs all models in a specific directory
dbt run --models* # select all models in path/to/models

For example, my project has a structure like:

  • models/base/
  • models/blue/
  • models/green/
  • models/red/

And I only want to build the models in the models/red/ folder. How would I do that?

Am I misunderstanding the documentation?


Hey @jon-rtr - I totally agree that this syntax is confusing! In this example, you could run the models in models/red/ with:

dbt run --models red.*

The .* is actually superfluous in most cases, but I like to add it to make things explicit.

The --models flag works this way to support selecting:

  1. models by name
  2. directories
  3. packages

Since it supports selecting three different types of things, the syntax is necessarily a little weird. Hope this helps!


Ok, that works for me in the basic case.

Let’s the structure is instead:

  • models/base
  • models/colors/red
  • models/colors/green
  • models/colors/blue

I can run dbt run --models colors.*, but not dbt run --models*. I get * Spec='*' does not identify any models and was ignored


Hey @jon-rtr – that shouldn’t be the case!

 dbt run --models*

^ that selector should indeed run the models in models/colors/red. I’m aware of a bug that can occur if the first directory in the path (here, colors) is the same as the name of the project. You can find the bug report for that here:

If that’s not the issue you’re seeing, are you able to open an issue with an example case that fails? This should definitely work, and if it currently doesn’t, it would be great to fix it!