Skip to content

Commit

Permalink
Update methods.md (#3548)
Browse files Browse the repository at this point in the history
resolves #3549

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

This PR adds the (undocumented!) `resource_type` method that has been
possible for a long, long time.

Reason: we discovered a selection method wasn't documented! So we did 😎 

## Not done

#3549 mentions that there are no examples for the wildcard method that
include `wildcard:`. This seems okay since the intent in
dbt-labs/dbt-core#6599 was to use Unix-style
wildcards in conjunction with all the other selection methods.

So we're choosing not to add `wildcard:` examples in this PR. If needed,
they can always be added later.

## 🎩 


[Preview](https://deploy-preview-3548--docs-getdbt-com.netlify.app/reference/node-selection/methods#the-resource_type-method)

<img width="550" alt="image"
src="https://github.com/dbt-labs/docs.getdbt.com/assets/44704949/c46f18c5-d4ea-4e9a-815d-7f682efa4ee2">


## Checklist
- [x] Review the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md)
and [About
versioning](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version)
so my content adheres to these guidelines.

---------

Co-authored-by: mirnawong1 <[email protected]>
Co-authored-by: Doug Beatty <[email protected]>
  • Loading branch information
3 people authored Jun 23, 2023
1 parent 4481170 commit fdeca48
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion website/docs/reference/node-selection/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ The `source` method is used to select models that select from a specified [sourc
$ dbt run --select source:snowplow+ # run all models that select from Snowplow sources
```

### The "resource_type" method
Use the `resource_type` method to select nodes of a particular type (`model`, `source`, `exposure`, etc). This is similar to the `--resource-type` flag used by the [`dbt ls` command](/reference/commands/list).

```bash
$ dbt build --select resource_type:exposure # build all resources upstream of exposures
$ dbt list --select resource_type:test # list all tests in your project
```

### The "path" method
The `path` method is used to select models/sources defined at or under a specific path.
Expand All @@ -72,6 +79,7 @@ The `file` or `fqn` method can be used to select a model by its filename, includ

```bash
# These are equivalent
dbt run --select file:some_model.sql
dbt run --select some_model.sql
dbt run --select some_model
dbt run --select fqn:some_model # fqn is an abbreviation for "fully qualified name"
Expand Down Expand Up @@ -335,4 +343,4 @@ dbt list --select access:private # list all private models
dbt list --select access:protected # list all protected models
```
</VersionBlock>
</VersionBlock>

0 comments on commit fdeca48

Please sign in to comment.