Skip to content

Commit

Permalink
Adding new indirect selection pages (#4977)
Browse files Browse the repository at this point in the history
resolves #4773 

## What are you changing in this pull request and why?
<!---
Describe your changes and why you're making them. If related to an open 
issue or a pull request on dbt Core, then link to them here! 

To learn more about the writing conventions used in the dbt Labs docs,
see the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md).
-->

## Checklist
<!--
Uncomment when publishing docs for a prerelease version of dbt:
- [ ] Add versioning components, as described in [Versioning
Docs](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-entire-pages)
- [ ] Add a note to the prerelease version [Migration
Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/docs/dbt-versions/core-upgrade)
-->
- [ ] Review the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md)
so my content adheres to these guidelines.
- [ ] For [docs
versioning](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#about-versioning),
review how to [version a whole
page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version)
and [version a block of
content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content).
- [ ] Add a checklist item for anything that needs to happen before this
PR is merged, such as "needs technical review" or "change base branch."

Adding or removing pages (delete if not applicable):
- [ ] Add/remove page in `website/sidebars.js`
- [ ] Provide a unique filename for new pages
- [ ] Add an entry for deleted pages in `website/static/_redirects`
- [ ] Run link testing locally with `npm run build` to update the links
that point to deleted pages
  • Loading branch information
matthewshaver authored Feb 27, 2024
2 parents 39dd7fc + 299bd00 commit 1faefd2
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 1 deletion.
4 changes: 4 additions & 0 deletions website/dbt-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ exports.versions = [
]

exports.versionedPages = [
{
"page": "reference/global-configs/indirect-selection",
"firstVersion": "1.8",
},
{
"page": "reference/resource-configs/store_failures_as",
"firstVersion": "1.7",
Expand Down
42 changes: 41 additions & 1 deletion website/docs/docs/core/connect-data-platform/profiles.yml.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ If you're using dbt Cloud, you can [connect to your data platform](/docs/cloud/c

This section identifies the parts of your `profiles.yml` that aren't specific to a particular data platform. For specific connection details, refer to the relevant page for your data platform.

<VersionBlock lastVersion="1.7">

:::warning Global configs

Starting in dbt v1.8, global configs have been deprecated from the `profiles.yml` file and should be configured in the [`dbt_project.yml`](/reference/dbt_project.yml) file instead.

:::

<File name='profiles.yml'>

```yml
Expand All @@ -28,6 +36,7 @@ This section identifies the parts of your `profiles.yml` that aren't specific to
[debug](/reference/global-configs/logs#log-level): <true | false>
[version_check](/reference/global-configs/version-compatibility): <true | false>
[fail_fast](/reference/global-configs/failing-fast): <true | false>
[indirect_selection](/reference/global-configs/indirect-selection): <eager | cautious | buildable | empty>
[use_experimental_parser](/reference/global-configs/parsing): <true | false>
[static_parser](/reference/global-configs/parsing): <true | false>
[cache_selected_only](/reference/global-configs/cache): <true | false>
Expand All @@ -54,6 +63,37 @@ This section identifies the parts of your `profiles.yml` that aren't specific to
</File>
</VersionBlock>
<VersionBlock firstVersion="1.8">
<File name='profiles.yml'>
```yml

<profile-name>:
target: <target-name> # this is the default target
outputs:
<target-name>:
type: <bigquery | postgres | redshift | snowflake | other>
schema: <schema_identifier>
threads: <natural_number>

### database-specific connection details
...

<target-name>: # additional targets
...

<profile-name>: # additional profiles
...

```
</File>
</VersionBlock>
## User config
You can set default values of global configs for all projects that you run using your local machine. See the docs on [global configs](/reference/global-configs/about-global-configs) for details.
You can set default values of global configs for all projects that you run using your local machine. Refer to [About global configs](/reference/global-configs/about-global-configs) for details.
53 changes: 53 additions & 0 deletions website/docs/reference/global-configs/indirect-selection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: "Indirect selection"
id: "indirect-selection"
sidebar: "Indirect selection"
---

Use the `--indirect_selection` flag to `dbt test` or `dbt build` to configure which tests to run for the nodes you specify. You can set this as a CLI flag or an environment variable. In dbt Core, you can also configure user configurations in [YAML selectors](/reference/node-selection/yaml-selectors) or in the `flags:` block of `dbt_project.yml`, which sets project-level flags.

When all flags are set, the order of precedence is as follows. Refer to [About global configs](/reference/global-configs/about-global-configs) for more details:

1. CLI configurations
1. Environment variables
1. User configurations

You can set the flag to: `empty`, `buildable`, `cautious`, or `eager` (default). By default, dbt indirectly selects all tests if they touch any resource you select. Learn more about these options in [Indirect selection in Test selection examples](/reference/node-selection/test-selection-examples?indirect-selection-mode=empty#indirect-selection).

For example, you can run tests that only refer to selected nodes using a CLI configuration:

<File name='Usage'>

```shell
dbt test --indirect-selection cautious
```

</File>

Or you can run tests that only refer to selected nodes using an environment variable:

<File name='Env var'>

```text
$ export DBT_INDIRECT_SELECTION=cautious
dbt run
```

</File>

You can also run tests that only refer to selected nodes using `dbt_project.yml` project-level flags:

<File name='dbt_project.yml'>

```yaml

flags:
indirect_selection: cautious

```

</File>


1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ const sidebarSettings = {
"reference/global-configs/logs",
"reference/global-configs/cache",
"reference/global-configs/failing-fast",
"reference/global-configs/indirect-selection",
"reference/global-configs/json-artifacts",
"reference/global-configs/legacy-behaviors",
"reference/global-configs/parsing",
Expand Down

0 comments on commit 1faefd2

Please sign in to comment.