diff --git a/website/docs/reference/commands/clone.md b/website/docs/reference/commands/clone.md
index a3c8bb236c7..ea3e570447d 100644
--- a/website/docs/reference/commands/clone.md
+++ b/website/docs/reference/commands/clone.md
@@ -21,7 +21,7 @@ The `clone` command is useful for:
dbt clone --state path/to/artifacts
# clone one_specific_model of my models from specified state to my target schema(s)
-dbt clone --select one_specific_model --state path/to/artifacts
+dbt clone --select "one_specific_model" --state path/to/artifacts
# clone all of my models from specified state to my target schema(s) and recreate all pre-existing relations in the current target
dbt clone --state path/to/artifacts --full-refresh
diff --git a/website/docs/reference/commands/compile.md b/website/docs/reference/commands/compile.md
index ed403d2af32..cde65b7c6b6 100644
--- a/website/docs/reference/commands/compile.md
+++ b/website/docs/reference/commands/compile.md
@@ -29,7 +29,7 @@ This will log the compiled SQL to the terminal, in addition to writing to the `t
For example:
```bash
-dbt compile --select stg_payments
+dbt compile --select "stg_payments"
dbt compile --inline "select * from {{ ref('raw_orders') }}"
```
@@ -37,7 +37,7 @@ returns the following:
```bash
-dbt compile --select stg_orders
+dbt compile --select "stg_orders"
21:17:09 Running with dbt=1.5.0-b5
21:17:09 Found 5 models, 20 tests, 0 snapshots, 0 analyses, 425 macros, 0 operations, 3 seed files, 0 sources, 0 exposures, 0 metrics, 0 groups
21:17:09
diff --git a/website/docs/reference/commands/list.md b/website/docs/reference/commands/list.md
index 6084b3dec70..fc2b5d60c57 100644
--- a/website/docs/reference/commands/list.md
+++ b/website/docs/reference/commands/list.md
@@ -8,6 +8,7 @@ id: "list"
The `dbt ls` command lists resources in your dbt project. It accepts selector arguments that are similar to those provided in [dbt run](/reference/commands/run). `dbt list` is an alias for `dbt ls`. While `dbt ls` will read your [connection profile](/docs/core/connect-data-platform/connection-profiles) to resolve [`target`](/reference/dbt-jinja-functions/target)-specific logic, this command will not connect to your database or run any queries.
### Usage
+
```
dbt ls
[--resource-type {model,source,seed,snapshot,metric,test,exposure,analysis,default,all}]
@@ -85,7 +86,7 @@ $ dbt ls --select snowplow.* --output json --output-keys "name resource_type des
```
-$ dbt ls --select snowplow.* --output json --output-keys name resource_type description
+$ dbt ls --select snowplow.* --output json --output-keys "name resource_type description"
{"name": "snowplow_events", "description": "This is a pretty cool model", ...}
{"name": "snowplow_page_views", "description": "This model is even cooler", ...}
...
diff --git a/website/docs/reference/commands/seed.md b/website/docs/reference/commands/seed.md
index 8a410706842..d0cd199ea12 100644
--- a/website/docs/reference/commands/seed.md
+++ b/website/docs/reference/commands/seed.md
@@ -12,7 +12,7 @@ The `dbt seed` command will load `csv` files located in the `seed-paths` directo
Specific seeds can be run using the `--select` flag to `dbt seed`. Example:
```
-$ dbt seed --select country_codes
+$ dbt seed --select "country_codes"
Found 2 models, 3 tests, 0 archives, 0 analyses, 53 macros, 0 operations, 2 seed files
14:46:15 | Concurrency: 1 threads (target='dev')
diff --git a/website/docs/reference/commands/show.md b/website/docs/reference/commands/show.md
index 5bdcfacc1e8..a0e5d68c83f 100644
--- a/website/docs/reference/commands/show.md
+++ b/website/docs/reference/commands/show.md
@@ -16,7 +16,7 @@ The results of the preview query are not materialized in the data warehouse, or
Example:
```
-dbt show --select model_name.sql
+dbt show --select "model_name.sql"
```
or
```
@@ -26,7 +26,7 @@ dbt show --inline "select * from {{ ref('model_name') }}"
The following is an example of `dbt show` output for a model named `stg_orders`:
```bash
-dbt show --select stg_orders
+dbt show --select "stg_orders"
21:17:38 Running with dbt=1.5.0-b5
21:17:38 Found 5 models, 20 tests, 0 snapshots, 0 analyses, 425 macros, 0 operations, 3 seed files, 0 sources, 0 exposures, 0 metrics, 0 groups
21:17:38
@@ -46,7 +46,7 @@ dbt show --select stg_orders
For example, if you've just built a model that has a failing test, you can quickly preview the test failures right in the terminal, to find values of `id` that are duplicated:
```bash
-$ dbt build -s my_model_with_duplicates
+$ dbt build -s "my_model_with_duplicates"
13:22:47 Running with dbt=1.5.0
...
13:22:48 Completed with 1 error and 0 warnings:
@@ -58,7 +58,7 @@ $ dbt build -s my_model_with_duplicates
13:22:48
13:22:48 Done. PASS=1 WARN=0 ERROR=1 SKIP=0 TOTAL=2
-$ dbt show -s unique_my_model_with_duplicates_id
+$ dbt show -s "unique_my_model_with_duplicates_id"
13:22:53 Running with dbt=1.5.0
13:22:53 Found 4 models, 2 tests, 0 snapshots, 0 analyses, 309 macros, 0 operations, 0 seed files, 0 sources, 0 exposures, 0 metrics, 0 groups
13:22:53
diff --git a/website/docs/reference/commands/source.md b/website/docs/reference/commands/source.md
index b29bf7dadc6..697ae2b5fcc 100644
--- a/website/docs/reference/commands/source.md
+++ b/website/docs/reference/commands/source.md
@@ -20,10 +20,10 @@ By default, `dbt source freshness` will calculate freshness information for all
```bash
# Snapshot freshness for all Snowplow tables:
-$ dbt source freshness --select source:snowplow
+$ dbt source freshness --select "source:snowplow"
# Snapshot freshness for a particular source table:
-$ dbt source freshness --select source:snowplow.event
+$ dbt source freshness --select "source:snowplow.event"
```
### Configuring source freshness output
diff --git a/website/docs/reference/commands/test.md b/website/docs/reference/commands/test.md
index a1a63729568..c050d82a0ab 100644
--- a/website/docs/reference/commands/test.md
+++ b/website/docs/reference/commands/test.md
@@ -10,22 +10,22 @@ The tests to run can be selected using the `--select` flag discussed [here](/ref
```bash
# run tests for one_specific_model
-dbt test --select one_specific_model
+dbt test --select "one_specific_model"
# run tests for all models in package
-dbt test --select some_package.*
+dbt test --select "some_package.*"
# run only tests defined singularly
-dbt test --select test_type:singular
+dbt test --select "test_type:singular"
# run only tests defined generically
-dbt test --select test_type:generic
+dbt test --select "test_type:generic"
# run singular tests limited to one_specific_model
-dbt test --select one_specific_model,test_type:singular
+dbt test --select "one_specific_model,test_type:singular"
# run generic tests limited to one_specific_model
-dbt test --select one_specific_model,test_type:generic
+dbt test --select "one_specific_model,test_type:generic"
```
For more information on writing tests, see the [Testing Documentation](/docs/build/tests).
diff --git a/website/docs/reference/dbt_project.yml.md b/website/docs/reference/dbt_project.yml.md
index c706b57a73b..b1fa061462c 100644
--- a/website/docs/reference/dbt_project.yml.md
+++ b/website/docs/reference/dbt_project.yml.md
@@ -11,6 +11,8 @@ By default, dbt will look for `dbt_project.yml` in your current working director
By default, dbt will look for `dbt_project.yml` in your current working directory and its parents, but you can set a different directory using the `--project-dir` flag or the `DBT_PROJECT_DIR` environment variable.
+Starting from dbt v1.5 and higher, you can specify your dbt Cloud project ID in the `dbt_project.yml` file using the `dbt-cloud` config, which doesn't require validation or storage in the project config class. To find your project ID, check your dbt Cloud project URL, such as `https://cloud.getdbt.com/11/projects/123456`, where the project ID is `123456`.
+
The following is a list of all available configurations in the `dbt_project.yml` file.
@@ -19,6 +21,9 @@ The following is a list of all available configurations in the `dbt_project.yml`
dbt uses YAML in a few different places. If you're new to YAML, it would be worth taking the time to learn how arrays, dictionaries and strings are represented.
:::
+
+
+
```yml
@@ -48,6 +53,9 @@ dbt uses YAML in a few different places. If you're new to YAML, it would be wort
[require-dbt-version](/reference/project-configs/require-dbt-version): version-range | [version-range]
+[dbt-cloud](/docs/cloud/cloud-cli-installation):
+ project-id: project_id
+
[quoting](/reference/project-configs/quoting):
database: true | false
schema: true | false
@@ -79,6 +87,77 @@ vars:
search_order: [packagename]
[restrict-access](/docs/collaborate/govern/model-access): true | false
+
```
+
+
+
+
+
+
+```yml
+[name](/reference/project-configs/name): string
+
+[config-version](/reference/project-configs/config-version): 2
+[version](/reference/project-configs/version): version
+
+[profile](/reference/project-configs/profile): profilename
+
+[model-paths](/reference/project-configs/model-paths): [directorypath]
+[seed-paths](/reference/project-configs/seed-paths): [directorypath]
+[test-paths](/reference/project-configs/test-paths): [directorypath]
+[analysis-paths](/reference/project-configs/analysis-paths): [directorypath]
+[macro-paths](/reference/project-configs/macro-paths): [directorypath]
+[snapshot-paths](/reference/project-configs/snapshot-paths): [directorypath]
+[docs-paths](/reference/project-configs/docs-paths): [directorypath]
+[asset-paths](/reference/project-configs/asset-paths): [directorypath]
+
+[target-path](/reference/project-configs/target-path): directorypath
+[log-path](/reference/project-configs/log-path): directorypath
+[packages-install-path](/reference/project-configs/packages-install-path): directorypath
+
+[clean-targets](/reference/project-configs/clean-targets): [directorypath]
+
+[query-comment](/reference/project-configs/query-comment): string
+
+[require-dbt-version](/reference/project-configs/require-dbt-version): version-range | [version-range]
+
+[quoting](/reference/project-configs/quoting):
+ database: true | false
+ schema: true | false
+ identifier: true | false
+
+models:
+ [](/reference/model-configs)
+
+seeds:
+ [](/reference/seed-configs)
+
+snapshots:
+ [](/reference/snapshot-configs)
+
+sources:
+ [](source-configs)
+
+tests:
+ [](/reference/test-configs)
+
+vars:
+ [](/docs/build/project-variables)
+
+[on-run-start](/reference/project-configs/on-run-start-on-run-end): sql-statement | [sql-statement]
+[on-run-end](/reference/project-configs/on-run-start-on-run-end): sql-statement | [sql-statement]
+
+[dispatch](/reference/project-configs/dispatch-config):
+ - macro_namespace: packagename
+ search_order: [packagename]
+
+[restrict-access](/docs/collaborate/govern/model-access): true | false
+
+```
+
+
+
+
diff --git a/website/docs/reference/node-selection/defer.md b/website/docs/reference/node-selection/defer.md
index e13a4f6648a..03c3b2aac12 100644
--- a/website/docs/reference/node-selection/defer.md
+++ b/website/docs/reference/node-selection/defer.md
@@ -17,16 +17,16 @@ It is possible to use separate state for `state:modified` and `--defer`, by pass
### Usage
```shell
-$ dbt run --select [...] --defer --state path/to/artifacts
-$ dbt test --select [...] --defer --state path/to/artifacts
+dbt run --select [...] --defer --state path/to/artifacts
+dbt test --select [...] --defer --state path/to/artifacts
```
```shell
-$ dbt run --models [...] --defer --state path/to/artifacts
-$ dbt test --models [...] --defer --state path/to/artifacts
+dbt run --models [...] --defer --state path/to/artifacts
+dbt test --models [...] --defer --state path/to/artifacts
```
@@ -101,7 +101,7 @@ I want to test my changes. Nothing exists in my development schema, `dev_alice`.
```shell
-$ dbt run --select model_b
+dbt run --select "model_b"
```
@@ -128,7 +128,7 @@ Unless I had previously run `model_a` into this development environment, `dev_al
```shell
-$ dbt run --select model_b --defer --state prod-run-artifacts
+dbt run --select "model_b" --defer --state prod-run-artifacts
```
@@ -186,7 +186,7 @@ models:
```shell
-dbt test --select model_b
+dbt test --select "model_b"
```
@@ -211,7 +211,7 @@ The `relationships` test requires both `model_a` and `model_b`. Because I did no
```shell
-dbt test --select model_b --defer --state prod-run-artifacts
+dbt test --select "model_b" --defer --state prod-run-artifacts
```
diff --git a/website/docs/reference/node-selection/exclude.md b/website/docs/reference/node-selection/exclude.md
index 9ad4bd1cc0e..d2c140d1bb5 100644
--- a/website/docs/reference/node-selection/exclude.md
+++ b/website/docs/reference/node-selection/exclude.md
@@ -7,19 +7,19 @@ sidebar_label: "Exclude"
dbt provides an `--exclude` flag with the same semantics as `--select`. Models specified with the `--exclude` flag will be removed from the set of models selected with `--select`.
```bash
-$ dbt run --select my_package.*+ --exclude my_package.a_big_model+ # select all models in my_package and their children except a_big_model and its children
+dbt run --select "my_package".*+ --exclude "my_package.a_big_model+" # select all models in my_package and their children except a_big_model and its children
```
Exclude a specific resource by its name or lineage:
```bash
# test
-$ dbt test --exclude not_null_orders_order_id # test all models except the not_null_orders_order_id test
-$ dbt test --exclude orders # test all models except tests associated with the orders model
+dbt test --exclude "not_null_orders_order_id" # test all models except the not_null_orders_order_id test
+dbt test --exclude "orders" # test all models except tests associated with the orders model
# seed
-$ dbt seed --exclude account_parent_mappings # load all seeds except account_parent_mappings
+dbt seed --exclude "account_parent_mappings" # load all seeds except account_parent_mappings
# snapshot
-$ dbt snapshot --exclude snap_order_statuses # execute all snapshots except snap_order_statuses
+dbt snapshot --exclude "snap_order_statuses" # execute all snapshots except snap_order_statuses
```
diff --git a/website/docs/reference/node-selection/graph-operators.md b/website/docs/reference/node-selection/graph-operators.md
index 4fdc2f10628..8cba43e1b52 100644
--- a/website/docs/reference/node-selection/graph-operators.md
+++ b/website/docs/reference/node-selection/graph-operators.md
@@ -7,9 +7,9 @@ If placed at the front of the model selector, `+` will select all parents of the
```bash
- $ dbt run --select my_model+ # select my_model and all children
- $ dbt run --select +my_model # select my_model and all parents
- $ dbt run --select +my_model+ # select my_model, and all of its parents and children
+dbt run --select "my_model+" # select my_model and all children
+dbt run --select "+my_model" # select my_model and all parents
+dbt run --select "+my_model+" # select my_model, and all of its parents and children
```
@@ -20,9 +20,9 @@ to step through.
```bash
- $ dbt run --select my_model+1 # select my_model and its first-degree children
- $ dbt run --select 2+my_model # select my_model, its first-degree parents, and its second-degree parents ("grandparents")
- $ dbt run --select 3+my_model+4 # select my_model, its parents up to the 3rd degree, and its children down to the 4th degree
+dbt run --select "my_model+1" # select my_model and its first-degree children
+dbt run --select "2+my_model" # select my_model, its first-degree parents, and its second-degree parents ("grandparents")
+dbt run --select "3+my_model+4" # select my_model, its parents up to the 3rd degree, and its children down to the 4th degree
```
@@ -32,5 +32,5 @@ The `@` operator is similar to `+`, but will also include _the parents of the ch
```bash
-$ dbt run --models @my_model # select my_model, its children, and the parents of its children
+dbt run --models @my_model # select my_model, its children, and the parents of its children
```
diff --git a/website/docs/reference/node-selection/methods.md b/website/docs/reference/node-selection/methods.md
index 2647f3416a3..b829a11ec79 100644
--- a/website/docs/reference/node-selection/methods.md
+++ b/website/docs/reference/node-selection/methods.md
@@ -34,8 +34,8 @@ The `tag:` method is used to select models that match a specified [tag](/referen
```bash
- $ dbt run --select tag:nightly # run all models with the `nightly` tag
- ```
+dbt run --select "tag:nightly" # run all models with the `nightly` tag
+```
### The "source" method
@@ -43,22 +43,22 @@ The `source` method is used to select models that select from a specified [sourc
```bash
- $ dbt run --select source:snowplow+ # run all models that select from Snowplow sources
- ```
+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`, `test`, `exposure`, and so on). 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
- ```
+dbt build --select "resource_type:exposure" # build all resources upstream of exposures
+dbt list --select "resource_type:test" # list all tests in your project
+```
Note: This method doesn't work for sources, so use the [`--resource-type`](/reference/commands/list) option of the list command instead:
```bash
- $ dbt list --resource-type source
- ```
+dbt list --resource-type source
+```
### The "path" method
The `path` method is used to select models/sources defined at or under a specific path.
@@ -69,12 +69,12 @@ selectors unambiguous.
```bash
# These two selectors are equivalent
- dbt run --select path:models/staging/github
- dbt run --select models/staging/github
+ dbt run --select "path:models/staging/github"
+ dbt run --select "models/staging/github"
# These two selectors are equivalent
- dbt run --select path:models/staging/github/stg_issues.sql
- dbt run --select models/staging/github/stg_issues.sql
+ dbt run --select "path:models/staging/github/stg_issues.sql"
+ dbt run --select "models/staging/github/stg_issues.sql"
```
@@ -85,9 +85,9 @@ The `file` method can be used to select a model by its filename, including the f
```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 "file:some_model.sql"
+dbt run --select "some_model.sql"
+dbt run --select "some_model"
```
@@ -96,10 +96,10 @@ dbt run --select some_model
The `fqn` method is used to select nodes based off their "fully qualified names" (FQN) within the dbt graph. The default output of [`dbt list`](/reference/commands/list) is a listing of FQN.
-```
-dbt run --select fqn:some_model
-dbt run --select fqn:your_project.some_model
-dbt run --select fqn:some_package.some_other_model
+```bash
+dbt run --select "fqn:some_model"
+dbt run --select "fqn:your_project.some_model"
+dbt run --select "fqn:some_package.some_other_model"
```
### The "package" method
@@ -111,10 +111,10 @@ selectors unambiguous.
```bash
# These three selectors are equivalent
- dbt run --select package:snowplow
- dbt run --select snowplow
- dbt run --select snowplow.*
- ```
+ dbt run --select "package:snowplow"
+ dbt run --select "snowplow"
+ dbt run --select "snowplow.*"
+```
### The "config" method
@@ -124,10 +124,10 @@ The `config` method is used to select models that match a specified [node config
```bash
- $ dbt run --select config.materialized:incremental # run all models that are materialized incrementally
- $ dbt run --select config.schema:audit # run all models that are created in the `audit` schema
- $ dbt run --select config.cluster_by:geo_country # run all models clustered by `geo_country`
- ```
+dbt run --select "config.materialized:incremental" # run all models that are materialized incrementally
+dbt run --select "config.schema:audit" # run all models that are created in the `audit` schema
+dbt run --select "config.cluster_by:geo_country" # run all models clustered by `geo_country`
+```
@@ -135,7 +135,8 @@ The `config` method is used to select models that match a specified [node config
While most config values are strings, you can also use the `config` method to match boolean configs, dictionary keys, and values in lists.
For example, given a model with the following configurations:
-```
+
+```bash
{{ config(
materialized = 'incremental',
unique_key = ['column_a', 'column_b'],
@@ -148,10 +149,10 @@ select ...
You can select using any of the following:
```bash
-$ dbt ls -s config.materialized:incremental
-$ dbt ls -s config.unique_key:column_a
-$ dbt ls -s config.grants.select:reporter
-$ dbt ls -s config.transient:true
+dbt ls -s config.materialized:incremental
+dbt ls -s config.unique_key:column_a
+dbt ls -s config.grants.select:reporter
+dbt ls -s config.transient:true
```
@@ -162,10 +163,10 @@ The `test_type` method is used to select tests based on their type, `singular` o
- ```bash
- $ dbt test --select test_type:generic # run all generic tests
- $ dbt test --select test_type:singular # run all singular tests
- ```
+```bash
+dbt test --select "test_type:generic" # run all generic tests
+dbt test --select "test_type:singular" # run all singular tests
+```
### The "test_name" method
@@ -176,10 +177,10 @@ that defines it. For more information about how generic tests are defined, read
```bash
- $ dbt test --select test_name:unique # run all instances of the `unique` test
- $ dbt test --select test_name:equality # run all instances of the `dbt_utils.equality` test
- $ dbt test --select test_name:range_min_max # run all instances of a custom schema test defined in the local project, `range_min_max`
- ```
+dbt test --select "test_name:unique" # run all instances of the `unique` test
+dbt test --select "test_name:equality" # run all instances of the `dbt_utils.equality` test
+dbt test --select "test_name:range_min_max" # run all instances of a custom schema test defined in the local project, `range_min_max`
+```
### The "state" method
@@ -204,9 +205,9 @@ The `state` method is used to select nodes by comparing them against a previous
```bash
- $ dbt test --select state:new # run all tests on new models + and new tests on old models
- $ dbt run --select state:modified # run all models that have been modified
- $ dbt ls --select state:modified # list all modified nodes (not just models)
+dbt test --select "state:new " # run all tests on new models + and new tests on old models
+dbt run --select "state:modified" # run all models that have been modified
+dbt ls --select "state:modified" # list all modified nodes (not just models)
```
@@ -236,18 +237,18 @@ The `exposure` method is used to select parent resources of a specified [exposur
```bash
- $ dbt run --select +exposure:weekly_kpis # run all models that feed into the weekly_kpis exposure
- $ dbt test --select +exposure:* # test all resources upstream of all exposures
- $ dbt ls --select +exposure:* --resource-type source # list all sources upstream of all exposures
- ```
+dbt run --select "+exposure:weekly_kpis" # run all models that feed into the weekly_kpis exposure
+dbt test --select "+exposure:*" # test all resources upstream of all exposures
+dbt ls --select "+exposure:*" --resource-type source # list all sources upstream of all exposures
+```
### The "metric" method
The `metric` method is used to select parent resources of a specified [metric](/docs/build/metrics). Use in conjunction with the `+` operator.
```bash
-$ dbt build --select +metric:weekly_active_users # build all resources upstream of weekly_active_users metric
-$ dbt ls --select +metric:* --resource-type source # list all source tables upstream of all metrics
+dbt build --select "+metric:weekly_active_users" # build all resources upstream of weekly_active_users metric
+dbt ls --select "+metric:*" --resource-type source # list all source tables upstream of all metrics
```
### The "result" method
@@ -255,10 +256,10 @@ $ dbt ls --select +metric:* --resource-type source # list all source tables
The `result` method is related to the `state` method described above and can be used to select resources based on their result status from a prior run. Note that one of the dbt commands [`run`, `test`, `build`, `seed`] must have been performed in order to create the result on which a result selector operates. You can use `result` selectors in conjunction with the `+` operator.
```bash
-$ dbt run --select result:error --state path/to/artifacts # run all models that generated errors on the prior invocation of dbt run
-$ dbt test --select result:fail --state path/to/artifacts # run all tests that failed on the prior invocation of dbt test
-$ dbt build --select 1+result:fail --state path/to/artifacts # run all the models associated with failed tests from the prior invocation of dbt build
-$ dbt seed --select result:error --state path/to/artifacts # run all seeds that generated errors on the prior invocation of dbt seed.
+dbt run --select "result:error" --state path/to/artifacts # run all models that generated errors on the prior invocation of dbt run
+dbt test --select "result:fail" --state path/to/artifacts # run all tests that failed on the prior invocation of dbt test
+dbt build --select "1+result:fail" --state path/to/artifacts # run all the models associated with failed tests from the prior invocation of dbt build
+dbt seed --select "result:error" --state path/to/artifacts # run all seeds that generated errors on the prior invocation of dbt seed.
```
### The "source_status" method
@@ -276,8 +277,8 @@ After issuing one of the above commands, you can reference the source freshness
```bash
# You can also set the DBT_ARTIFACT_STATE_PATH environment variable instead of the --state flag.
-$ dbt source freshness # must be run again to compare current to previous state
-$ dbt build --select source_status:fresher+ --state path/to/prod/artifacts
+dbt source freshness # must be run again to compare current to previous state
+dbt build --select "source_status:fresher+" --state path/to/prod/artifacts
```
@@ -286,8 +287,8 @@ $ dbt build --select source_status:fresher+ --state path/to/prod/artifacts
```bash
# You can also set the DBT_STATE environment variable instead of the --state flag.
-$ dbt source freshness # must be run again to compare current to previous state
-$ dbt build --select source_status:fresher+ --state path/to/prod/artifacts
+dbt source freshness # must be run again to compare current to previous state
+dbt build --select "source_status:fresher+" --state path/to/prod/artifacts
```
@@ -305,9 +306,9 @@ Supported in v1.5 or newer.
The `group` method is used to select models defined within a [group](/reference/resource-configs/group).
- ```bash
- dbt run --select group:finance # run all models that belong to the finance group.
- ```
+```bash
+dbt run --select "group:finance" # run all models that belong to the finance group.
+```
@@ -324,9 +325,9 @@ Supported in v1.5 or newer.
The `access` method selects models based on their [access](/reference/resource-properties/access) property.
```bash
-dbt list --select access:public # list all public models
-dbt list --select access:private # list all private models
-dbt list --select access:protected # list all protected models
+dbt list --select "access:public" # list all public models
+dbt list --select "access:private" # list all private models
+dbt list --select "access:protected" # list all protected models
```
@@ -344,11 +345,11 @@ Supported in v1.5 or newer.
The `version` method selects [versioned models](/docs/collaborate/govern/model-versions) based on their [version identifier](/reference/resource-properties/versions) and [latest version](/reference/resource-properties/latest_version).
```bash
-dbt list --select version:latest # only 'latest' versions
-dbt list --select version:prerelease # versions newer than the 'latest' version
+dbt list --select "version:latest" # only 'latest' versions
+dbt list --select "version:prerelease" # versions newer than the 'latest' version
dbt list --select version:old # versions older than the 'latest' version
-dbt list --select version:none # models that are *not* versioned
+dbt list --select "version:none" # models that are *not* versioned
```
diff --git a/website/docs/reference/node-selection/putting-it-together.md b/website/docs/reference/node-selection/putting-it-together.md
index 8faf02e6cc9..48fc5188b32 100644
--- a/website/docs/reference/node-selection/putting-it-together.md
+++ b/website/docs/reference/node-selection/putting-it-together.md
@@ -4,16 +4,16 @@ title: "Putting it together"
```bash
- $ dbt run --select my_package.*+ # select all models in my_package and their children
- $ dbt run --select +some_model+ # select some_model and all parents and children
+dbt run --select "my_package.*+" # select all models in my_package and their children
+dbt run --select "+some_model+" # select some_model and all parents and children
- $ dbt run --select tag:nightly+ # select "nightly" models and all children
- $ dbt run --select +tag:nightly+ # select "nightly" models and all parents and children
+dbt run --select "tag:nightly+" # select "nightly" models and all children
+dbt run --select "+tag:nightly+" # select "nightly" models and all parents and children
- $ dbt run --select @source:snowplow # build all models that select from snowplow sources, plus their parents
+dbt run --select "@source:snowplow" # build all models that select from snowplow sources, plus their parents
- $ dbt test --select config.incremental_strategy:insert_overwrite,test_name:unique # execute all `unique` tests that select from models using the `insert_overwrite` incremental strategy
- ```
+dbt test --select "config.incremental_strategy:insert_overwrite,test_name:unique" # execute all `unique` tests that select from models using the `insert_overwrite` incremental strategy
+```
@@ -22,8 +22,8 @@ and feed exports, while _excluding_ the biggest incremental models (and one othe
```bash
- $ dbt run --select @source:snowplow,tag:nightly models/export --exclude package:snowplow,config.materialized:incremental export_performance_timing
- ```
+dbt run --select "@source:snowplow,tag:nightly models/export" --exclude "package:snowplow,config.materialized:incremental export_performance_timing"
+```
This command selects all models that:
diff --git a/website/docs/reference/node-selection/set-operators.md b/website/docs/reference/node-selection/set-operators.md
index 7d6b6c2411c..af399b9cad5 100644
--- a/website/docs/reference/node-selection/set-operators.md
+++ b/website/docs/reference/node-selection/set-operators.md
@@ -11,7 +11,7 @@ Run snowplow_sessions, all ancestors of snowplow_sessions, fct_orders, and all a
```bash
- $ dbt run --select +snowplow_sessions +fct_orders
+dbt run --select "+snowplow_sessions +fct_orders"
```
### Intersections
@@ -22,15 +22,15 @@ Run all the common ancestors of snowplow_sessions and fct_orders:
```bash
- $ dbt run --select +snowplow_sessions,+fct_orders
- ```
+dbt run --select "+snowplow_sessions,+fct_orders"
+```
Run all the common descendents of stg_invoices and stg_accounts:
```bash
- $ dbt run --select stg_invoices+,stg_accounts+
+dbt run --select "stg_invoices+,stg_accounts+"
```
@@ -38,5 +38,5 @@ Run models that are in the marts/finance subdirectory *and* tagged nightly:
```bash
- $ dbt run --select marts.finance,tag:nightly
- ```
+dbt run --select "marts.finance,tag:nightly"
+```
diff --git a/website/docs/reference/node-selection/state-comparison-caveats.md b/website/docs/reference/node-selection/state-comparison-caveats.md
index baeeb7e4c75..73947c80a66 100644
--- a/website/docs/reference/node-selection/state-comparison-caveats.md
+++ b/website/docs/reference/node-selection/state-comparison-caveats.md
@@ -27,8 +27,8 @@ The command `dbt test -s state:modified` will include both:
As long as you're adding or changing tests at the same time that you're adding or changing the resources (models, seeds, snapshots) they select from, all should work the way you expect with "simple" state selection:
```shell
-$ dbt run -s state:modified
-$ dbt test -s state:modified
+dbt run -s "state:modified"
+dbt test -s "state:modified"
```
This can get complicated, however. If you add a new test without modifying its underlying model, or add a test that selects from a new model and an old unmodified one, you may need to test a model without having first run it.
@@ -36,8 +36,8 @@ This can get complicated, however. If you add a new test without modifying its u
In v0.18.0, you needed to handle this by building the unmodified models needed for modified tests:
```shell
-$ dbt run -s state:modified @state:modified,1+test_type:data
-$ dbt test -s state:modified
+dbt run -s "state:modified @state:modified,1+test_type:data"
+dbt test -s "state:modified"
```
In v0.19.0, dbt added support for deferring upstream references when testing. If a test selects from a model that doesn't exist as a database object in your current environment, dbt will look to the other environment instead—the one defined in your state manifest. This enables you to use "simple" state selection without risk of query failure, but it may have some surprising consequences for tests with multiple parents. For instance, if you have a `relationships` test that depends on one modified model and one unmodified model, the test query will select from data "across" two different environments. If you limit or sample your data in development and CI, it may not make much sense to test for referential integrity, knowing there's a good chance of mismatch.
@@ -45,8 +45,8 @@ In v0.19.0, dbt added support for deferring upstream references when testing. If
If you're a frequent user of `relationships` tests or data tests, or frequently find yourself adding tests without modifying their underlying models, consider tweaking the selection criteria of your CI job. For instance:
```shell
-$ dbt run -s state:modified
-$ dbt test -s state:modified --exclude test_name:relationships
+dbt run -s "state:modified"
+dbt test -s "state:modified" --exclude "test_name:relationships"
```
### False positives
@@ -58,7 +58,7 @@ State comparison works by identifying discrepancies between two manifests. Thos
dbt will do its best to capture *only* changes that are the result of modifications made in development. In projects with intricate env-aware logic, dbt will err on the side of running too many models (i.e. false positives). Over the next several versions of dbt, we're working on:
- iterative improvements to dbt's built-in detective abilities
-- better options for more complex projects, in the form of more-specific subselectors (see [this issue](https://github.com/dbt-labs/dbt-core/issues/2704))
+- better options for more complex projects, in the form of more-specific sub-selectors (see [this issue](https://github.com/dbt-labs/dbt-core/issues/2704))
State comparison is now able to detect env-aware config in `dbt_project.yml`. For instance, this target-based config would register as a modification in v0.18.0, but in v0.19.0 it no longer will:
diff --git a/website/docs/reference/node-selection/syntax.md b/website/docs/reference/node-selection/syntax.md
index 7c165b0f4ff..cb8496259d1 100644
--- a/website/docs/reference/node-selection/syntax.md
+++ b/website/docs/reference/node-selection/syntax.md
@@ -24,6 +24,8 @@ We use the terms "
By default, `dbt run` executes _all_ of the models in the dependency graph; `dbt seed` creates all seeds, `dbt snapshot` performs every snapshot. The `--select` flag is used to specify a subset of nodes to execute.
+To follow [POSIX standards](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html) and make things easier to understand, we recommend CLI users use quotes when passing arguments to the `--select` or `--exclude` option (including single or multiple space-delimited, or comma-delimited arguments). Not using quotes might not work reliably on all operating systems, terminals, and user interfaces. For example, `dbt run --select "my_dbt_project_name"` runs all models in your project.
+
### How does selection work?
1. dbt gathers all the resources that are matched by one or more of the `--select` criteria, in the order of selection methods (e.g. `tag:`), then graph operators (e.g. `+`), then finally set operators ([unions](/reference/node-selection/set-operators#unions), [intersections](/reference/node-selection/set-operators#intersections), [exclusions](/reference/node-selection/exclude)).
@@ -51,28 +53,28 @@ Examples:
```bash
- $ dbt run --select my_dbt_project_name # runs all models in your project
- $ dbt run --select my_dbt_model # runs a specific model
- $ dbt run --select path.to.my.models # runs all models in a specific directory
- $ dbt run --select my_package.some_model # run a specific model in a specific package
- $ dbt run --select tag:nightly # run models with the "nightly" tag
- $ dbt run --select path/to/models # run models contained in path/to/models
- $ dbt run --select path/to/my_model.sql # run a specific model by its path
+dbt run --select "my_dbt_project_name" # runs all models in your project
+dbt run --select "my_dbt_model" # runs a specific model
+dbt run --select "path.to.my.models" # runs all models in a specific directory
+dbt run --select "my_package.some_model" # run a specific model in a specific package
+dbt run --select "tag:nightly" # run models with the "nightly" tag
+dbt run --select "path/to/models" # run models contained in path/to/models
+dbt run --select "path/to/my_model.sql" # run a specific model by its path
```
dbt supports a shorthand language for defining subsets of nodes. This language uses the characters `+`, `@`, `*`, and `,`.
```bash
- # multiple arguments can be provided to --select
- $ dbt run --select my_first_model my_second_model
+# multiple arguments can be provided to --select
+ dbt run --select "my_first_model my_second_model"
- # these arguments can be projects, models, directory paths, tags, or sources
- $ dbt run --select tag:nightly my_model finance.base.*
+# these arguments can be projects, models, directory paths, tags, or sources
+dbt run --select "tag:nightly my_model finance.base.*"
- # use methods and intersections for more complex selectors
- $ dbt run --select path:marts/finance,tag:nightly,config.materialized:table
- ```
+# use methods and intersections for more complex selectors
+dbt run --select "path:marts/finance,tag:nightly,config.materialized:table"
+```
As your selection logic gets more complex, and becomes unwieldly to type out as command-line arguments,
consider using a [yaml selector](/reference/node-selection/yaml-selectors). You can use a predefined definition with the `--selector` flag.
@@ -150,7 +152,7 @@ After issuing one of the above commands, you can reference the results by adding
```bash
# You can also set the DBT_ARTIFACT_STATE_PATH environment variable instead of the --state flag.
-$ dbt run --select result: --defer --state path/to/prod/artifacts
+dbt run --select "result: --defer --state path/to/prod/artifacts"
```
The available options depend on the resource (node) type:
@@ -169,7 +171,7 @@ The available options depend on the resource (node) type:
The state and result selectors can also be combined in a single invocation of dbt to capture errors from a previous run OR any new or modified models.
```bash
-$ dbt run --select result:+ state:modified+ --defer --state ./
+dbt run --select "result:+ state:modified+ --defer --state ./"
```
### Fresh rebuilds
@@ -183,7 +185,7 @@ As example:
```bash
# Command step order
dbt source freshness
-dbt build --select source_status:fresher+
+dbt build --select "source_status:fresher+"
```
@@ -202,6 +204,6 @@ After issuing one of the above commands, you can reference the source freshness
```bash
# You can also set the DBT_ARTIFACT_STATE_PATH environment variable instead of the --state flag.
-$ dbt source freshness # must be run again to compare current to previous state
-$ dbt build --select source_status:fresher+ --state path/to/prod/artifacts
+dbt source freshness # must be run again to compare current to previous state
+dbt build --select "source_status:fresher+" --state path/to/prod/artifacts
```
diff --git a/website/docs/reference/node-selection/test-selection-examples.md b/website/docs/reference/node-selection/test-selection-examples.md
index 52439d95d97..17b0f48de1e 100644
--- a/website/docs/reference/node-selection/test-selection-examples.md
+++ b/website/docs/reference/node-selection/test-selection-examples.md
@@ -19,14 +19,14 @@ Run generic tests only:
```bash
- $ dbt test --select test_type:generic
+ dbt test --select "test_type:generic"
```
Run singular tests only:
```bash
- $ dbt test --select test_type:singular
+ dbt test --select "test_type:singular"
```
In both cases, `test_type` checks a property of the test itself. These are forms of "direct" test selection.
@@ -87,8 +87,8 @@ By default, a test will run when ANY parent is selected; we call this "eager" in
In this mode, any test that depends on unbuilt resources will raise an error.
```shell
-$ dbt test --select orders
-$ dbt build --select orders
+dbt test --select "orders"
+dbt build --select "orders"
```
@@ -102,8 +102,8 @@ It will only include tests whose references are each within the selected nodes.
Put another way, it will prevent tests from running if one or more of its parents is unselected.
```shell
-$ dbt test --select orders --indirect-selection=cautious
-$ dbt build --select orders --indirect-selection=cautious
+dbt test --select "orders" --indirect-selection=cautious
+dbt build --select "orders" --indirect-selection=cautious
```
@@ -122,8 +122,8 @@ By default, a test will run when ANY parent is selected; we call this "eager" in
In this mode, any test that depends on unbuilt resources will raise an error.
```shell
-$ dbt test --select orders
-$ dbt build --select orders
+dbt test --select "orders"
+dbt build --select "orders"
```
@@ -137,8 +137,8 @@ It will only include tests whose references are each within the selected nodes.
Put another way, it will prevent tests from running if one or more of its parents is unselected.
```shell
-$ dbt test --select orders --indirect-selection=cautious
-$ dbt build --select orders --indirect-selection=cautious
+dbt test --select "orders" --indirect-selection=cautious
+dbt build --select "orders" --indirect-selection=cautious
```
@@ -152,8 +152,8 @@ It will only include tests whose references are each within the selected nodes (
This is useful in the same scenarios as "cautious", but also includes when a test depends on a model **and** a direct ancestor of that model (like confirming an aggregation has the same totals as its input).
```shell
-$ dbt test --select orders --indirect-selection=buildable
-$ dbt build --select orders --indirect-selection=buildable
+dbt test --select "orders" --indirect-selection=buildable
+dbt build --select "orders" --indirect-selection=buildable
```
@@ -172,8 +172,8 @@ By default, a test will run when ANY parent is selected; we call this "eager" in
In this mode, any test that depends on unbuilt resources will raise an error.
```shell
-$ dbt test --select orders
-$ dbt build --select orders
+dbt test --select "orders"
+dbt build --select "orders"
```
@@ -187,8 +187,8 @@ It will only include tests whose references are each within the selected nodes.
Put another way, it will prevent tests from running if one or more of its parents is unselected.
```shell
-$ dbt test --select orders --indirect-selection=cautious
-$ dbt build --select orders --indirect-selection=cautious
+dbt test --select "orders" --indirect-selection=cautious
+dbt build --select "orders" --indirect-selection=cautious
```
@@ -202,8 +202,8 @@ It will only include tests whose references are each within the selected nodes (
This is useful in the same scenarios as "cautious", but also includes when a test depends on a model **and** a direct ancestor of that model (like confirming an aggregation has the same totals as its input).
```shell
-$ dbt test --select orders --indirect-selection=buildable
-$ dbt build --select orders --indirect-selection=buildable
+dbt test --select "orders" --indirect-selection=buildable
+dbt build --select "orders" --indirect-selection=buildable
```
@@ -213,8 +213,8 @@ $ dbt build --select orders --indirect-selection=buildable
This mode will only include tests whose references are each within the selected nodes and will ignore all tests from attached nodes.
```shell
-$ dbt test --select orders --indirect-selection=empty
-$ dbt build --select orders --indirect-selection=empty
+dbt test --select "orders" --indirect-selection=empty
+dbt build --select "orders" --indirect-selection=empty
```
@@ -234,22 +234,22 @@ The following examples should feel somewhat familiar if you're used to executing
```bash
# Run tests on a model (indirect selection)
- $ dbt test --select customers
+ dbt test --select "customers"
# Run tests on all models in the models/staging/jaffle_shop directory (indirect selection)
- $ dbt test --select staging.jaffle_shop
+ dbt test --select "staging.jaffle_shop"
# Run tests downstream of a model (note this will select those tests directly!)
- $ dbt test --select stg_customers+
+ dbt test --select "stg_customers+"
# Run tests upstream of a model (indirect selection)
- $ dbt test --select +stg_customers
+ dbt test --select "+stg_customers"
# Run tests on all models with a particular tag (direct + indirect)
- $ dbt test --select tag:my_model_tag
+ dbt test --select "tag:my_model_tag"
# Run tests on all models with a particular materialization (indirect selection)
- $ dbt test --select config.materialized:table
+ dbt test --select "config.materialized:table"
```
@@ -258,16 +258,16 @@ The following examples should feel somewhat familiar if you're used to executing
```bash
# tests on all sources
- $ dbt test --select source:*
+ dbt test --select "source:*"
# tests on one source
- $ dbt test --select source:jaffle_shop
+ dbt test --select "source:jaffle_shop"
# tests on one source table
- $ dbt test --select source:jaffle_shop.customers
+ dbt test --select "source:jaffle_shop.customers"
# tests on everything _except_ sources
- $ dbt test --exclude source:*
+ dbt test --exclude "source:*"
```
### More complex selection
@@ -276,10 +276,10 @@ Through the combination of direct and indirect selection, there are many ways to
```bash
- $ dbt test --select assert_total_payment_amount_is_positive # directly select the test by name
- $ dbt test --select payments,test_type:singular # indirect selection, v1.2
- $ dbt test --select payments,test_type:data # indirect selection, v0.18.0
- $ dbt test --select payments --data # indirect selection, earlier versions
+ dbt test --select "assert_total_payment_amount_is_positive" # directly select the test by name
+ dbt test --select "payments,test_type:singular" # indirect selection, v1.2
+ dbt test --select "payments,test_type:data" # indirect selection, v0.18.0
+ dbt test --select "payments" --data # indirect selection, earlier versions
```
@@ -288,13 +288,13 @@ Through the combination of direct and indirect selection, there are many ways to
```bash
# Run tests on all models with a particular materialization
- $ dbt test --select config.materialized:table
+ dbt test --select "config.materialized:table"
# Run tests on all seeds, which use the 'seed' materialization
- $ dbt test --select config.materialized:seed
+ dbt test --select "config.materialized:seed"
# Run tests on all snapshots, which use the 'snapshot' materialization
- $ dbt test --select config.materialized:snapshot
+ dbt test --select "config.materialized:snapshot"
```
Note that this functionality may change in future versions of dbt.
@@ -322,7 +322,7 @@ models:
```bash
- $ dbt test --select tag:my_column_tag
+ dbt test --select "tag:my_column_tag"
```
Currently, tests "inherit" tags applied to columns, sources, and source tables. They do _not_ inherit tags applied to models, seeds, or snapshots. In all likelihood, those tests would still be selected indirectly, because the tag selects its parent. This is a subtle distinction, and it may change in future versions of dbt.
@@ -350,5 +350,5 @@ models:
```bash
- $ dbt test --select tag:my_test_tag
+ dbt test --select "tag:my_test_tag"
```
diff --git a/website/docs/reference/node-selection/yaml-selectors.md b/website/docs/reference/node-selection/yaml-selectors.md
index 78342e32779..1e3f8d8d1e2 100644
--- a/website/docs/reference/node-selection/yaml-selectors.md
+++ b/website/docs/reference/node-selection/yaml-selectors.md
@@ -34,6 +34,7 @@ Each `definition` is comprised of one or more arguments, which can be one of the
Use the `union` and `intersection` operator-equivalent keywords to organize multiple arguments.
### CLI-style
+
```yml
definition:
'tag:nightly'
@@ -42,6 +43,7 @@ definition:
This simple syntax supports use of the `+`, `@`, and `*` [graph](/reference/node-selection/graph-operators) operators, but it does not support [set](/reference/node-selection/set-operators) operators or `exclude`.
### Key-value
+
```yml
definition:
tag: nightly
@@ -317,7 +319,7 @@ selectors:
Then in our job definition:
```bash
-$ dbt run --selector nightly_diet_snowplow
+dbt run --selector nightly_diet_snowplow
```
## Default
@@ -325,6 +327,7 @@ $ dbt run --selector nightly_diet_snowplow
Selectors may define a boolean `default` property. If a selector has `default: true`, dbt will use this selector's criteria when tasks do not define their own selection criteria.
Let's say we define a default selector that only selects resources defined in our root project:
+
```yml
selectors:
- name: root_project_only
@@ -338,16 +341,18 @@ selectors:
```
If I run an "unqualified" command, dbt will use the selection criteria defined in `root_project_only`—that is, dbt will only build / freshness check / generate compiled SQL for resources defined in my root project.
+
```
-$ dbt build
-$ dbt source freshness
-$ dbt docs generate
+dbt build
+dbt source freshness
+dbt docs generate
```
If I run a command that defines its own selection criteria (via `--select`, `--exclude`, or `--selector`), dbt will ignore the default selector and use the flag criteria instead. It will not try to combine the two.
-```
-$ dbt run --select model_a
-$ dbt run --exclude model_a
+
+```bash
+dbt run --select "model_a"
+dbt run --exclude model_a
```
Only one selector may set `default: true` for a given invocation; otherwise, dbt will return an error. You may use a Jinja expression to adjust the value of `default` depending on the environment, however: