From 64a623649d8a9623b98397b8449c31400f99436f Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:28:51 +0000 Subject: [PATCH 1/8] add plus operator example to tags doc this pr adds an example combining tags and the plus operator in the `tags` doc and the `+ operator` doc. Resolves #6735 --- website/docs/reference/resource-configs/tags.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/website/docs/reference/resource-configs/tags.md b/website/docs/reference/resource-configs/tags.md index c222df8c1ae..cfe142f39ea 100644 --- a/website/docs/reference/resource-configs/tags.md +++ b/website/docs/reference/resource-configs/tags.md @@ -113,11 +113,17 @@ resource_type: Apply a tag (or list of tags) to a resource. These tags can be used as part of the [resource selection syntax](/reference/node-selection/syntax), when running the following commands: -- `dbt run --select tag:my_tag` -- `dbt build --select tag:my_tag` -- `dbt seed --select tag:my_tag` -- `dbt snapshot --select tag:my_tag` -- `dbt test --select tag:my_tag` (indirectly runs all tests associated with the models that are tagged) +- `dbt run --select tag:my_tag` — Run all models tagged with a specific tag. +- `dbt build --select tag:my_tag` — Build all resources tagged with a specific tag. +- `dbt seed --select tag:my_tag` — Seed all resources tagged with a specific tag. +- `dbt snapshot --select tag:my_tag` — Snapshot all resources tagged with a specific tag. +- `dbt test --select tag:my_tag` — Indirectly runs all tests associated with the models that are tagged. + +#### Using tags with the `+` operator +You can use the [`+` operator](/reference/node-selection/graph-operators#the-plus-operator) to include upstream or downstream dependencies in your `tag` selection: +- `dbt run --select tag:my_tag+` — Run models tagged with `my_tag` and all their downstream dependencies (children). +- `dbt run --select +tag:my_tag` — Run models tagged with `my_tag` and all their upstream dependencies (parents). +- `dbt run --select +model_name+` — Run a model, its upstream dependencies (parents), and its downstream dependencies (children). ## Examples ### Use tags to run parts of your project From 2e5736d383bd85cb4a9f15cc53ca35bdb0b1e475 Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:34:06 +0000 Subject: [PATCH 2/8] Update tags.md --- website/docs/reference/resource-configs/tags.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/reference/resource-configs/tags.md b/website/docs/reference/resource-configs/tags.md index cfe142f39ea..10a2afa6806 100644 --- a/website/docs/reference/resource-configs/tags.md +++ b/website/docs/reference/resource-configs/tags.md @@ -124,6 +124,7 @@ You can use the [`+` operator](/reference/node-selection/graph-operators#the-plu - `dbt run --select tag:my_tag+` — Run models tagged with `my_tag` and all their downstream dependencies (children). - `dbt run --select +tag:my_tag` — Run models tagged with `my_tag` and all their upstream dependencies (parents). - `dbt run --select +model_name+` — Run a model, its upstream dependencies (parents), and its downstream dependencies (children). +- `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. ## Examples ### Use tags to run parts of your project From 195a143ae834400c2e7dc0ab88f482ba8a712697 Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:40:44 +0000 Subject: [PATCH 3/8] Update graph-operators.md add more context in operator page --- .../docs/reference/node-selection/graph-operators.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/website/docs/reference/node-selection/graph-operators.md b/website/docs/reference/node-selection/graph-operators.md index 455af9aa137..0414e70f285 100644 --- a/website/docs/reference/node-selection/graph-operators.md +++ b/website/docs/reference/node-selection/graph-operators.md @@ -3,15 +3,19 @@ title: "Graph operators" --- ### The "plus" operator -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. +The `+` operator expands your selection to include ancestors (upstream dependencies) or descendants (downstream dependencies) of a resource. This operator works for individual models, tags, or other resources. +- `+` operator placed after a model/resource — Includes the resource itself and all its descendants (downstream dependencies). +- `+` operator placed before a model/resource — Includes the resource itself and all its ancestors (upstream dependencies). +- `+` operator placed on both sides of a model/resource — Includes the resource itself, all its ancestors, and all its descendants. - ```bash +```bash dbt run --select "my_model+" # select my_model and all descendants dbt run --select "+my_model" # select my_model and all ancestors dbt run --select "+my_model+" # select my_model, and all of its ancestors and descendants - ``` +``` +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) for even more finer control over what gets included in your command. ### The "n-plus" operator From 65feb93b3c8006c6c20312b9791b5a719b435360 Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:42:05 +0000 Subject: [PATCH 4/8] Update tags.md --- website/docs/reference/resource-configs/tags.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/reference/resource-configs/tags.md b/website/docs/reference/resource-configs/tags.md index 10a2afa6806..5bb5e9a9c43 100644 --- a/website/docs/reference/resource-configs/tags.md +++ b/website/docs/reference/resource-configs/tags.md @@ -121,9 +121,9 @@ These tags can be used as part of the [resource selection syntax](/reference/nod #### Using tags with the `+` operator You can use the [`+` operator](/reference/node-selection/graph-operators#the-plus-operator) to include upstream or downstream dependencies in your `tag` selection: -- `dbt run --select tag:my_tag+` — Run models tagged with `my_tag` and all their downstream dependencies (children). -- `dbt run --select +tag:my_tag` — Run models tagged with `my_tag` and all their upstream dependencies (parents). -- `dbt run --select +model_name+` — Run a model, its upstream dependencies (parents), and its downstream dependencies (children). +- `dbt run --select tag:my_tag+` — Run models tagged with `my_tag` and all their downstream dependencies. +- `dbt run --select +tag:my_tag` — Run models tagged with `my_tag` and all their upstream dependencies. +- `dbt run --select +model_name+` — Run a model, its upstream dependencies, and its downstream dependencies. - `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. ## Examples From 733116ff40f76b468acc79361d853d8e55159ce0 Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:46:10 +0000 Subject: [PATCH 5/8] Update graph-operators.md --- website/docs/reference/node-selection/graph-operators.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/reference/node-selection/graph-operators.md b/website/docs/reference/node-selection/graph-operators.md index 0414e70f285..61cdb163da7 100644 --- a/website/docs/reference/node-selection/graph-operators.md +++ b/website/docs/reference/node-selection/graph-operators.md @@ -5,9 +5,9 @@ title: "Graph operators" ### The "plus" operator The `+` operator expands your selection to include ancestors (upstream dependencies) or descendants (downstream dependencies) of a resource. This operator works for individual models, tags, or other resources. -- `+` operator placed after a model/resource — Includes the resource itself and all its descendants (downstream dependencies). -- `+` operator placed before a model/resource — Includes the resource itself and all its ancestors (upstream dependencies). -- `+` operator placed on both sides of a model/resource — Includes the resource itself, all its ancestors, and all its descendants. +- Placed after a model/resource — Includes the resource itself and all its descendants (downstream dependencies). +- Placed before a model/resource — Includes the resource itself and all its ancestors (upstream dependencies). +- Placed on both sides of a model/resource — Includes the resource itself, all its ancestors, and all its descendants. ```bash dbt run --select "my_model+" # select my_model and all descendants From 741e2d9eb24ae9886258eced66d20b0c1d75065d Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:25:39 +0000 Subject: [PATCH 6/8] Update website/docs/reference/node-selection/graph-operators.md Co-authored-by: nataliefiann <120089939+nataliefiann@users.noreply.github.com> --- website/docs/reference/node-selection/graph-operators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/reference/node-selection/graph-operators.md b/website/docs/reference/node-selection/graph-operators.md index 61cdb163da7..5566770704c 100644 --- a/website/docs/reference/node-selection/graph-operators.md +++ b/website/docs/reference/node-selection/graph-operators.md @@ -3,7 +3,7 @@ title: "Graph operators" --- ### The "plus" operator -The `+` operator expands your selection to include ancestors (upstream dependencies) or descendants (downstream dependencies) of a resource. This operator works for individual models, tags, or other resources. +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. - Placed after a model/resource — Includes the resource itself and all its descendants (downstream dependencies). - Placed before a model/resource — Includes the resource itself and all its ancestors (upstream dependencies). From 412ed586b59093f5cabdad3cc2864af06e2fb9b9 Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:28:02 +0000 Subject: [PATCH 7/8] Update website/docs/reference/node-selection/graph-operators.md Co-authored-by: nataliefiann <120089939+nataliefiann@users.noreply.github.com> --- website/docs/reference/node-selection/graph-operators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/reference/node-selection/graph-operators.md b/website/docs/reference/node-selection/graph-operators.md index 5566770704c..6ea4b9b7fa9 100644 --- a/website/docs/reference/node-selection/graph-operators.md +++ b/website/docs/reference/node-selection/graph-operators.md @@ -15,7 +15,7 @@ dbt run --select "+my_model" # select my_model and all ancestors dbt run --select "+my_model+" # select my_model, and all of its ancestors and descendants ``` -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) for even more finer control over what gets included in your command. +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. ### The "n-plus" operator From d9cd26dacd5f085c0c23506d37878b1b3083884d Mon Sep 17 00:00:00 2001 From: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:29:50 +0000 Subject: [PATCH 8/8] Update website/docs/reference/resource-configs/tags.md Co-authored-by: nataliefiann <120089939+nataliefiann@users.noreply.github.com> --- website/docs/reference/resource-configs/tags.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/reference/resource-configs/tags.md b/website/docs/reference/resource-configs/tags.md index 5bb5e9a9c43..505a33a00f7 100644 --- a/website/docs/reference/resource-configs/tags.md +++ b/website/docs/reference/resource-configs/tags.md @@ -124,7 +124,7 @@ You can use the [`+` operator](/reference/node-selection/graph-operators#the-plu - `dbt run --select tag:my_tag+` — Run models tagged with `my_tag` and all their downstream dependencies. - `dbt run --select +tag:my_tag` — Run models tagged with `my_tag` and all their upstream dependencies. - `dbt run --select +model_name+` — Run a model, its upstream dependencies, and its downstream dependencies. -- `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. +- `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. ## Examples ### Use tags to run parts of your project