---
title: "Resource type"
source: dbt Core Documentation
source_url: https://github.com/dbt-labs/docs.getdbt.com
licence: Apache-2.0
domain: data-and-analysis
subdomain: dbt-docs
date_added: 2026-04-25
---

<VersionBlock firstVersion="1.9">

The `--resource-type` and `--exclude-resource-type` flags include or exclude resource types from the `dbt build`, `dbt clone`, `dbt test`, and `dbt list` commands.

<Expandable alt_header="Filtering test types with dbt test">

Use the `test_type` selector to filter test types with `dbt test` &mdash; it works across all engines:

- `dbt test --select test_type:unit` &mdash; runs only unit tests
- `dbt test --select test_type:data` &mdash; runs only data tests

If you're using <Constant name="core" /> v1.9+, you can also use `--resource-type`:

- `dbt test --resource-type unit_test` &mdash; runs only unit tests
- `dbt test --resource-type test` &mdash; runs only data tests

For more examples, see [test selection examples](/reference/node-selection/test-selection-examples).
</Expandable>

</VersionBlock>

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.

:::tip Note
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:

<VersionBlock lastVersion="1.10">

- [`analysis`](/docs/build/analyses)
- [`exposure`](/docs/build/exposures)
- [`metric`](/docs/build/build-metrics-intro)
- [`model`](/docs/build/models)
- [`saved_query`](/docs/build/saved-queries)
- [`seed`](/docs/build/seeds)
- [`semantic_model`](/docs/build/semantic-models)
- [`snapshot`](/docs/build/snapshots)
- [`source`](/docs/build/sources)
- [`test`](/docs/build/data-tests)
- [`unit_test`](/docs/build/unit-tests)
</VersionBlock>

<VersionBlock firstVersion="1.11"> 

- [`analysis`](/docs/build/analyses)
- [`exposure`](/docs/build/exposures)
- [`function`](/docs/build/udfs)
- [`metric`](/docs/build/build-metrics-intro)
- [`model`](/docs/build/models)
- [`saved_query`](/docs/build/saved-queries)
- [`seed`](/docs/build/seeds)
- [`semantic_model`](/docs/build/semantic-models)
- [`snapshot`](/docs/build/snapshots)
- [`source`](/docs/build/sources)
- [`test`](/docs/build/data-tests)
- [`unit_test`](/docs/build/unit-tests)
</VersionBlock>


## Positive vs negative filters

- `--resource-type` is a positive filter &mdash; dbt only runs the resource types selected in the command, implicitly skipping every other type.
- `--exclude-resource-type` is a negative filter &mdash; 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:

```text
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.

<Expandable alt_header="Include resource types">

### Include multiple resource types

Use the following command to include multiple resource types such as data tests and models in your build process:

<File name='Usage'>

```text
dbt build --resource-type test model
```

</File>

### Include all snapshots

Use the following command to only include snapshots in your dbt build process:

<File name='Usage'>

```text
dbt build --resource-type snapshot
```

</File>


### Include all saved queries

Use the following command to only include saved queries with the `--resource-type` flag:

<File name='Usage'>

```text
dbt build --resource-type saved_query
```

</File>

### Include all data tests

Use the following command to only include data tests in your build process:

<File name='Usage'>

```text
dbt build --resource-type test
```

</File>

<VersionBlock firstVersion="1.9">

### Include only data tests during testing

To run only data tests (excluding unit tests) when using `dbt test`, use the `test_type` selector:

<File name='Usage'>

```text
dbt test --select test_type:data -- dbt Core and dbt Fusion engines
dbt test --resource-type test -- dbt Core only
```

</File>

</VersionBlock>

</Expandable>
<Expandable alt_header="Exclude resource types">

### Exclude multiple resource types

Use the following command to exclude multiple resource types such as data tests and models from your build process:

<File name='Usage'>

```text
dbt build --exclude-resource-type test model
```

</File>

### Exclude all unit tests

Use the following command to exclude unit tests from your dbt build process.

<File name='Usage'>

```text
dbt build --exclude-resource-type unit_test
```

</File>

<VersionBlock firstVersion="1.9">

### Exclude unit tests during testing

To exclude unit tests when using `dbt test`, use the `test_type` selector to run only data tests:

<File name='Usage'>

```text
dbt test --select test_type:data -- dbt Core and dbt Fusion engines
dbt test --exclude-resource-type unit_test -- dbt Core only
```

</File>

</VersionBlock>
</Expandable>
