-
Notifications
You must be signed in to change notification settings - Fork 977
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'current' into rpourzand-dbt-partner-source
- Loading branch information
Showing
9 changed files
with
165 additions
and
72 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
86 changes: 86 additions & 0 deletions
86
website/docs/reference/resource-configs/on_configuration_change.md
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,86 @@ | ||
--- | ||
resource_types: [models] | ||
description: "on_configuration_change - Read this in-depth guide to learn about configuration change monitoring in dbt." | ||
datatype: "string" | ||
--- | ||
|
||
:::info | ||
This functionality is currently only supported for [materialized views](/docs/build/materializations#materialized-view) on a subset of adapters. | ||
::: | ||
|
||
The `on_configuration_change` config has three settings: | ||
- `apply` (default) — Attempt to update the existing database object if possible, avoiding a complete rebuild. | ||
- *Note:* If any individual configuration change requires a full refresh, a full refresh be performed in lieu of individual alter statements. | ||
- `continue` — Allow runs to continue while also providing a warning that the object was left untouched. | ||
- *Note:* This could result in downstream failures as those models may depend on these unimplemented changes. | ||
- `fail` — Force the entire run to fail if a change is detected. | ||
|
||
<Tabs | ||
groupId="config-languages" | ||
defaultValue="project-yaml" | ||
values={[ | ||
{ label: 'Project file', value: 'project-yaml', }, | ||
{ label: 'Property file', value: 'property-yaml', }, | ||
{ label: 'Config block', value: 'config', }, | ||
] | ||
}> | ||
|
||
|
||
<TabItem value="project-yaml"> | ||
|
||
<File name='dbt_project.yml'> | ||
|
||
```yaml | ||
models: | ||
[<resource-path>](/reference/resource-configs/resource-path): | ||
[+](/reference/resource-configs/plus-prefix)[materialized](/reference/resource-configs/materialized): <materialization_name> | ||
[+](/reference/resource-configs/plus-prefix)on_configuration_change: apply | continue | fail | ||
``` | ||
</File> | ||
</TabItem> | ||
<TabItem value="property-yaml"> | ||
<File name='models/properties.yml'> | ||
```yaml | ||
version: 2 | ||
|
||
models: | ||
- name: [<model-name>] | ||
config: | ||
[materialized](/reference/resource-configs/materialized): <materialization_name> | ||
on_configuration_change: apply | continue | fail | ||
``` | ||
</File> | ||
</TabItem> | ||
<TabItem value="config"> | ||
<File name='models/<model_name>.sql'> | ||
```jinja | ||
{{ config( | ||
[materialized](/reference/resource-configs/materialized)="<materialization_name>", | ||
on_configuration_change="apply" | "continue" | "fail" | ||
) }} | ||
``` | ||
|
||
</File> | ||
|
||
</TabItem> | ||
|
||
</Tabs> | ||
|
||
Materializations are implemented following this "drop through" life cycle: | ||
1. If a model does not exist with the provided path, create the new model. | ||
2. If a model exists, but has a different type, drop the existing model and create the new model. | ||
3. If `--full-refresh` is supplied, replace the existing model regardless of configuration changes and the `on_configuration_change` setting. | ||
4. If there are no configuration changes, perform the default action for that type (e.g. apply refresh for a materialized view). | ||
5. Determine whether to apply the configuration changes according to the `on_configuration_change` setting. |
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.