-
Notifications
You must be signed in to change notification settings - Fork 999
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add info about + prefix and splits config page (#6932)
- Loading branch information
Showing
12 changed files
with
271 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
title: Define configs | ||
sidebar_label: Define configs | ||
intro_text: "Learn how to define configurations for your resources in a dbt project" | ||
description: "Learn how to define configurations for your resources in a dbt project" | ||
pagination_previous: "reference/configs-and-properties" | ||
pagination_next: "reference/define-properties" | ||
--- | ||
|
||
Depending on the resource type, you can define configurations in a dbt project and also in an installed package by: | ||
|
||
<VersionBlock firstVersion="1.9"> | ||
|
||
1. Using a [`config` property](/reference/resource-properties/config) in a `.yml` file for supported resource directories like `models/`, `snapshots/`, `seeds/`, `analyses`, `tests/`, and more. | ||
2. From the [`dbt_project.yml` file](dbt_project.yml), under the corresponding resource key (`models:`, `snapshots:`, `tests:`, and so on) | ||
</VersionBlock> | ||
|
||
<VersionBlock lastVersion="1.8"> | ||
|
||
1. Using a [`config()` Jinja macro](/reference/dbt-jinja-functions/config) within a `model`, `snapshot`, or `test` SQL file | ||
2. Using a [`config` property](/reference/resource-properties/config) in a `.yml` file for supported resource directories like `models/`, `snapshots/`, `seeds/`, `analyses/`, or `tests/` directory. | ||
3. From the [`dbt_project.yml` file](dbt_project.yml), under the corresponding resource key (`models:`, `snapshots:`, `tests:`, and so on) | ||
</VersionBlock> | ||
|
||
## Config inheritance | ||
|
||
The most specific config always takes precedence. This generally follows the order above: an in-file `config()` block --> properties defined in a `.yml` file --> config defined in the project file. | ||
|
||
Note - Generic data tests work a little differently when it comes to specificity. See [test configs](/reference/data-test-configs). | ||
|
||
Within the project file, configurations are also applied hierarchically. The most specific config always takes precedence. In the project file, for example, configurations applied to a `marketing` subdirectory will take precedence over configurations applied to the entire `jaffle_shop` project. To apply a configuration to a model or directory of models, define the [resource path](/reference/resource-configs/resource-path) as nested dictionary keys. | ||
|
||
Configurations in your root dbt project have _higher_ precedence than configurations in installed packages. This enables you to override the configurations of installed packages, providing more control over your dbt runs. | ||
|
||
## Combining configs | ||
|
||
Most configurations are "clobbered" when applied hierarchically. Whenever a more specific value is available, it will completely replace the less specific value. Note that a few configs have different merge behavior: | ||
- [`tags`](/tags) are additive. If a model has some tags configured in `dbt_project.yml`, and more tags applied in its `.sql` file, the final set of tags will include all of them. | ||
- [`meta`](/reference/resource-configs/meta) dictionaries are merged (a more specific key-value pair replaces a less specific value with the same key) | ||
- [`pre-hook` and `post-hook`](/reference/resource-configs/pre-hook-post-hook) are also additive. | ||
|
||
## The `+` prefix | ||
|
||
import PlusPrefix from '/snippets/_plus-prefix.md'; | ||
|
||
<PlusPrefix /> | ||
|
||
|
||
import Example from '/snippets/_configs-properties.md' ; | ||
|
||
<Example /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
title: Define properties | ||
sidebar_label: Define properties | ||
intro_text: "Learn how to define properties for your resources in a properties.yml file" | ||
description: "Learn how to define properties for your resources in a properties.yml file" | ||
pagination_previous: "reference/define-configs" | ||
--- | ||
|
||
In dbt, you can use `properties.yml` files to define properties for resources. You can declare properties in `.yml` files, in the same directory as your resources. You can name these files `whatever_you_want.yml` and nest them arbitrarily in sub-folders within each directory. | ||
|
||
We highly recommend that you define properties in dedicated paths alongside the resources they're describing. | ||
|
||
:::info | ||
|
||
#### schema.yml files | ||
|
||
Previous versions of the docs referred to these as `schema.yml` files — we've moved away from that terminology since the word `schema` is used to mean other things when talking about databases, and people often thought that you _had_ to name these files `schema.yml`. | ||
|
||
Instead, we now refer to these files as `properties.yml` files. (Of course, you're still free to name your files `schema.yml`) | ||
git pull | ||
::: | ||
|
||
### Which properties are _not_ also configs? | ||
|
||
In dbt, you can define node configs in `properties.yml` files, in addition to `config()` blocks and `dbt_project.yml`. However, some special properties can only be defined in the `.yml` file and you cannot configure them using `config()` blocks or the `dbt_project.yml` file: | ||
|
||
Certain properties are special, because: | ||
|
||
- They have a unique Jinja rendering context | ||
- They create new project resources | ||
- They don't make sense as hierarchical configuration | ||
- They're older properties that haven't yet been redefined as configs | ||
|
||
These properties are: | ||
|
||
- [`description`](/reference/resource-properties/description) | ||
- [`tests`](/reference/resource-properties/data-tests) | ||
- [`docs`](/reference/resource-configs/docs) | ||
- [`columns`](/reference/resource-properties/columns) | ||
- [`quote`](/reference/resource-properties/quote) | ||
- [`source` properties](/reference/source-properties) (for example, `loaded_at_field`, `freshness`) | ||
- [`exposure` properties](/reference/exposure-properties) (for example, `type`, `maturity`) | ||
- [`macro` properties](/reference/macro-properties) (for example, `arguments`) | ||
|
||
import Example from '/snippets/_configs-properties.md' ; | ||
|
||
<Example /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.