From 993f4446b115232d574eb802cd050ec145ea3412 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 7 Dec 2023 13:45:00 -0500 Subject: [PATCH] break out configuration change monitoring from materialized views --- website/docs/docs/build/materializations.md | 47 +++++----- .../on_configuration_change.md | 86 +++++++++++++++++++ 2 files changed, 111 insertions(+), 22 deletions(-) create mode 100644 website/docs/reference/resource-configs/on_configuration_change.md diff --git a/website/docs/docs/build/materializations.md b/website/docs/docs/build/materializations.md index 192284a31ca..67796afdbdb 100644 --- a/website/docs/docs/build/materializations.md +++ b/website/docs/docs/build/materializations.md @@ -109,27 +109,7 @@ When using the `table` materialization, your model is rebuilt as a + + + + + + +```yaml +models: + [](/reference/resource-configs/resource-path): + [+](/reference/resource-configs/plus-prefix)[materialized](/reference/resource-configs/materialized): + [+](/reference/resource-configs/plus-prefix)on_configuration_change: apply | continue | fail +``` + + + + + + + + + + +```yaml +version: 2 + +models: + - name: [] + config: + [materialized](/reference/resource-configs/materialized): + on_configuration_change: apply | continue | fail +``` + + + + + + + + + + +```jinja +{{ config( + [materialized](/reference/resource-configs/materialized)="", + on_configuration_change="apply" | "continue" | "fail" +) }} +``` + + + + + + + +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