Skip to content

Commit 1c26bb2

Browse files
add plus operator example to tags doc (#6737)
this pr adds an example combining tags and the plus operator in the `tags` doc and the `+ operator` doc. Resolves #6735 <!-- vercel-deployment-preview --> --- 🚀 Deployment available! Here are the direct links to the updated files: - https://docs-getdbt-com-git-mirnawong1-patch-26-dbt-labs.vercel.app/reference/node-selection/graph-operators - https://docs-getdbt-com-git-mirnawong1-patch-26-dbt-labs.vercel.app/reference/resource-configs/tags <!-- end-vercel-deployment-preview --> --------- Co-authored-by: nataliefiann <[email protected]>
1 parent 495a66d commit 1c26bb2

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

website/docs/reference/node-selection/graph-operators.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ title: "Graph operators"
33
---
44

55
### The "plus" operator
6-
If placed at the front of the model selector, `+` will select all ancestors of the selected model and the model itself. If placed at the end of the string, `+` will select all descendants of the selected model and the model itself.
6+
The `+` operator expands your selection to include ancestors (upstream dependencies) or descendants (downstream dependencies) of a resource. This operator works for individual models, tags, and other resources.
77

8+
- Placed after a model/resource &mdash; Includes the resource itself and all its descendants (downstream dependencies).
9+
- Placed before a model/resource &mdash; Includes the resource itself and all its ancestors (upstream dependencies).
10+
- Placed on both sides of a model/resource &mdash; Includes the resource itself, all its ancestors, and all its descendants.
811

9-
```bash
12+
```bash
1013
dbt run --select "my_model+" # select my_model and all descendants
1114
dbt run --select "+my_model" # select my_model and all ancestors
1215
dbt run --select "+my_model+" # select my_model, and all of its ancestors and descendants
13-
```
16+
```
1417

18+
You can use it with selectors for a more specific scope in your commands. You can also combine it with [`--exclude`](/reference/node-selection/exclude) flag for even more finer control over what gets included in your command.
1519

1620
### The "n-plus" operator
1721

website/docs/reference/resource-configs/tags.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,18 @@ resource_type:
113113
Apply a tag (or list of tags) to a resource.
114114

115115
These tags can be used as part of the [resource selection syntax](/reference/node-selection/syntax), when running the following commands:
116-
- `dbt run --select tag:my_tag`
117-
- `dbt build --select tag:my_tag`
118-
- `dbt seed --select tag:my_tag`
119-
- `dbt snapshot --select tag:my_tag`
120-
- `dbt test --select tag:my_tag` (indirectly runs all tests associated with the models that are tagged)
116+
- `dbt run --select tag:my_tag` &mdash; Run all models tagged with a specific tag.
117+
- `dbt build --select tag:my_tag` &mdash; Build all resources tagged with a specific tag.
118+
- `dbt seed --select tag:my_tag` &mdash; Seed all resources tagged with a specific tag.
119+
- `dbt snapshot --select tag:my_tag` &mdash; Snapshot all resources tagged with a specific tag.
120+
- `dbt test --select tag:my_tag` &mdash; Indirectly runs all tests associated with the models that are tagged.
121+
122+
#### Using tags with the `+` operator
123+
You can use the [`+` operator](/reference/node-selection/graph-operators#the-plus-operator) to include upstream or downstream dependencies in your `tag` selection:
124+
- `dbt run --select tag:my_tag+` &mdash; Run models tagged with `my_tag` and all their downstream dependencies.
125+
- `dbt run --select +tag:my_tag` &mdash; Run models tagged with `my_tag` and all their upstream dependencies.
126+
- `dbt run --select +model_name+` &mdash; Run a model, its upstream dependencies, and its downstream dependencies.
127+
- `dbt run --select tag:my_tag+ --exclude tag:exclude_tag` &mdash; Run model tagged with `my_tag` and their downstream dependencies, and exclude models tagged with `exclude_tag`, regardless of their dependencies.
121128

122129
## Examples
123130
### Use tags to run parts of your project

0 commit comments

Comments
 (0)