You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/reference/node-selection/graph-operators.md
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,19 @@ title: "Graph operators"
3
3
---
4
4
5
5
### 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.
7
7
8
+
- Placed after a model/resource — Includes the resource itself and all its descendants (downstream dependencies).
9
+
- Placed before a model/resource — Includes the resource itself and all its ancestors (upstream dependencies).
10
+
- Placed on both sides of a model/resource — Includes the resource itself, all its ancestors, and all its descendants.
8
11
9
-
```bash
12
+
```bash
10
13
dbt run --select "my_model+"# select my_model and all descendants
11
14
dbt run --select "+my_model"# select my_model and all ancestors
12
15
dbt run --select "+my_model+"# select my_model, and all of its ancestors and descendants
13
-
```
16
+
```
14
17
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.
Copy file name to clipboardExpand all lines: website/docs/reference/resource-configs/tags.md
+12-5Lines changed: 12 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -113,11 +113,18 @@ resource_type:
113
113
Apply a tag (or list of tags) to a resource.
114
114
115
115
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`— Run all models tagged with a specific tag.
117
+
-`dbt build --select tag:my_tag`— Build all resources tagged with a specific tag.
118
+
-`dbt seed --select tag:my_tag`— Seed all resources tagged with a specific tag.
119
+
-`dbt snapshot --select tag:my_tag`— Snapshot all resources tagged with a specific tag.
120
+
-`dbt test --select tag:my_tag`— 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+`— Run models tagged with `my_tag` and all their downstream dependencies.
125
+
-`dbt run --select +tag:my_tag`— Run models tagged with `my_tag` and all their upstream dependencies.
126
+
-`dbt run --select +model_name+`— Run a model, its upstream dependencies, and its downstream dependencies.
127
+
-`dbt run --select tag:my_tag+ --exclude tag:exclude_tag`— Run model tagged with `my_tag` and their downstream dependencies, and exclude models tagged with `exclude_tag`, regardless of their dependencies.
0 commit comments