Skip to content

Commit

Permalink
dbt test supports --resource-type / --exclude-resource-type CLI…
Browse files Browse the repository at this point in the history
… flags and related environment variables (#6192)

[Preview](https://docs-getdbt-com-git-dbeatty-6101-docs-dbt-labs.vercel.app/reference/global-configs/resource-type)

Resolves #6101
Originally #6126

## What are you changing in this pull request and why?

Beginning in dbt-core v1.9, it is possible to use the `--resource-type`
and `--exclude-resource-type` CLI flags (and related env vars) with the
`dbt test` command.

## Checklist
- [x] I have reviewed the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md)
so my content adheres to these guidelines.
- [x] The topic I'm writing about is for specific dbt version(s) and I
have versioned it according to the [version a whole
page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version)
and/or [version a block of
content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content)
guidelines.
- [x] Add a note to the prerelease version [Migration
Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/docs/dbt-versions/core-upgrade)

---------

Co-authored-by: Natalie Fiann <Natalie.Fiann@dbtlabs.com>
Co-authored-by: nataliefiann <120089939+nataliefiann@users.noreply.github.com>
Co-authored-by: Matt Shaver <60105315+matthewshaver@users.noreply.github.com>
Co-authored-by: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
  • Loading branch information
5 people authored Oct 1, 2024
1 parent 74f48b6 commit 364da5b
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion website/docs/reference/global-configs/resource-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ id: "resource-type"
sidebar: "resource type"
---

The `--resource-type` and `--exclude-resource-type` flags include or exclude resource types from the `dbt build`, `dbt clone`, and `dbt list` commands.
<VersionBlock lastVersion="1.8">

The `--resource-type` and `--exclude-resource-type` flags include or exclude resource types from the `dbt build`, `dbt clone`, and `dbt list` commands. In Versionless and from dbt v1.9 onwards, these flags are also supported in the `dbt test` command.

</VersionBlock>

<VersionBlock firstVersion="1.9">

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.

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

Expand Down Expand Up @@ -109,3 +119,27 @@ Instead of targeting specific resources, use the `--resource-flag` or `--exclude
</File>
</VersionBlock>
<VersionBlock firstVersion="1.9">
- In this example, use the following command to exclude _all_ unit tests when running tests:
<File name='Usage'>
```text
dbt test --exclude-resource-type unit_test
```
</File>
- In this example, use the following command to include all data tests when running tests:
<File name='Usage'>
```text
dbt test --resource-type test
```
</File>
</VersionBlock>

0 comments on commit 364da5b

Please sign in to comment.