-
Notifications
You must be signed in to change notification settings - Fork 982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Break out configuration change monitoring from materialized views #4610
Merged
matthewshaver
merged 12 commits into
current
from
content/model-config/on-configuration-change
Dec 18, 2023
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
993f444
break out configuration change monitoring from materialized views
mikealfare 8e7c519
add the new page to website/sidebars.js
mikealfare de97675
Merge branch 'current' into content/model-config/on-configuration-change
mikealfare 6f77ff8
add links to the new on_configuration_change page, update "learn more…
mikealfare 57a8079
Merge branch 'current' into content/model-config/on-configuration-change
mikealfare 062abb5
add on_configuration_change to dbt-versions.js with first version 1.6
mikealfare 95f2f6d
Merge remote-tracking branch 'origin/content/model-config/on-configur…
mikealfare 80f2b60
Merge branch 'current' into content/model-config/on-configuration-change
mikealfare a6b4c67
Merge branch 'current' into content/model-config/on-configuration-change
mikealfare 03bb342
Update on_configuration_change.md
matthewshaver 358bae1
Merge branch 'current' into content/model-config/on-configuration-change
matthewshaver 218c9c7
Merge branch 'current' into content/model-config/on-configuration-change
matthewshaver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.