Resource type
The --resource-type
and --exclude-resource-type
flags include or exclude resource types from the dbt build
, dbt test
, dbt clone
, and dbt list
commands.
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:
Example
Instead of targeting specific resources, use the --resource-flag
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.
-
For example, use the following command to include all snapshots from your dbt build process:
Usagedbt build --resource-type snapshot
-
In this example, run the following command to include all saved queries with the
--resource-type
flag:Usagedbt build --resource-type saved_query
-
In this example, use the following command to exclude all unit tests from your dbt build process. Note that the
--exclude-resource-type
flag is only available in dbt version 1.8 and higher:Usagedbt build --exclude-resource-type unit_test
-
In this example, use the following command to include all data tests in your build process:
Usagedbt build --resource-type test
-
In this example, use the following command to exclude all unit tests when running tests:
Usagedbt test --exclude-resource-type unit_test
-
In this example, use the following command to include all data tests when running tests:
Usagedbt test --resource-type test