Resource type
This means the flags enable you to specify which types of resources to include or exclude when running the commands, instead of targeting specific resources.
The --exclude-resource-type
flag is only available in dbt version 1.8 and higher. If you're using older versions, this flag won't be available.
The available resource types are:
Positive vs negative filters
--resource-type
is a positive filter — dbt only runs the resource types selected in the command, implicitly skipping every other type.--exclude-resource-type
is a negative filter — dbt starts with the full catalog of resource types and then omits the types selected in the command. dbt runs everything except those resource types.
You can use both flags in a command; dbt first applies the positive filter (--resource-type
) and then removes the types listed in the negative filter (--exclude-resource-type
). For example:
dbt build --resource-type model test snapshot --exclude-resource-type snapshot
Note that the list of dbt resource types is mutually exclusive and collectively exhaustive (MECE). This means that any --resource-type
selection can also be achieved by excluding the other resource types using --exclude-resource-type
, and vice versa.
Examples
Instead of targeting specific resources, use the --resource-type
or --exclude-resource-type
flags to target all resources of a certain type: dbt build --resource-type RESOURCE_TYPE
, replacing RESOURCE_TYPE
with the resource type you want to include.
See the following sample commands for including or excluding resource types. Note that the --exclude-resource-type
flag is only available in dbt version 1.8 and higher.