From b16587b97123e5acc79c0aa09d8efe92a926cf4b Mon Sep 17 00:00:00 2001 From: johnny-stevens Date: Thu, 3 Oct 2024 11:23:18 -0400 Subject: [PATCH] Update snowflake-configs.md Removed duplicate "Dynamic Tables" section at the end of the page --- .../resource-configs/snowflake-configs.md | 264 ------------------ 1 file changed, 264 deletions(-) diff --git a/website/docs/reference/resource-configs/snowflake-configs.md b/website/docs/reference/resource-configs/snowflake-configs.md index b0a0ca18bea..0ce930c1cb8 100644 --- a/website/docs/reference/resource-configs/snowflake-configs.md +++ b/website/docs/reference/resource-configs/snowflake-configs.md @@ -692,270 +692,6 @@ models: - -The Snowflake adapter supports [dynamic tables](https://docs.snowflake.com/en/user-guide/dynamic-tables-about). -This materialization is specific to Snowflake, which means that any model configuration that -would normally come along for the ride from `dbt-core` (e.g. as with a `view`) may not be available -for dynamic tables. This gap will decrease in future patches and versions. -While this materialization is specific to Snowflake, it very much follows the implementation -of [materialized views](/docs/build/materializations#Materialized-View). -In particular, dynamic tables have access to the `on_configuration_change` setting. -Dynamic tables are supported with the following configuration parameters: - - - -| Parameter | Type | Required | Default | Change Monitoring Support | -|--------------------|------------|----------|-------------|---------------------------| -| [`on_configuration_change`](/reference/resource-configs/on_configuration_change) | `` | no | `apply` | n/a | -| [`target_lag`](#target-lag) | `` | yes | | alter | -| [`snowflake_warehouse`](#configuring-virtual-warehouses) | `` | yes | | alter | - - - - -| Parameter | Type | Required | Default | Change Monitoring Support | -|--------------------|------------|----------|-------------|---------------------------| -| [`on_configuration_change`](/reference/resource-configs/on_configuration_change) | `` | no | `apply` | n/a | -| [`target_lag`](#target-lag) | `` | yes | | alter | -| [`snowflake_warehouse`](#configuring-virtual-warehouses) | `` | yes | | alter | -| [`refresh_mode`](#refresh-mode) | `` | no | `AUTO` | refresh | -| [`initialize`](#initialize) | `` | no | `ON_CREATE` | n/a | - - - - - - - - - - - -```yaml -models: - [](/reference/resource-configs/resource-path): - [+](/reference/resource-configs/plus-prefix)[materialized](/reference/resource-configs/materialized): dynamic_table - [+](/reference/resource-configs/plus-prefix)[on_configuration_change](/reference/resource-configs/on_configuration_change): apply | continue | fail - [+](/reference/resource-configs/plus-prefix)[target_lag](#target-lag): downstream | - [+](/reference/resource-configs/plus-prefix)[snowflake_warehouse](#configuring-virtual-warehouses): - -``` - - - - - - - - - - -```yaml -version: 2 - -models: - - name: [] - config: - [materialized](/reference/resource-configs/materialized): dynamic_table - [on_configuration_change](/reference/resource-configs/on_configuration_change): apply | continue | fail - [target_lag](#target-lag): downstream | - [snowflake_warehouse](#configuring-virtual-warehouses): - -``` - - - - - - - - - - -```jinja - -{{ config( - [materialized](/reference/resource-configs/materialized)="dynamic_table", - [on_configuration_change](/reference/resource-configs/on_configuration_change)="apply" | "continue" | "fail", - [target_lag](#target-lag)="downstream" | " seconds | minutes | hours | days", - [snowflake_warehouse](#configuring-virtual-warehouses)="", - -) }} - -``` - - - - - - - - - - - - - - - - - -```yaml -models: - [](/reference/resource-configs/resource-path): - [+](/reference/resource-configs/plus-prefix)[materialized](/reference/resource-configs/materialized): dynamic_table - [+](/reference/resource-configs/plus-prefix)[on_configuration_change](/reference/resource-configs/on_configuration_change): apply | continue | fail - [+](/reference/resource-configs/plus-prefix)[target_lag](#target-lag): downstream | - [+](/reference/resource-configs/plus-prefix)[snowflake_warehouse](#configuring-virtual-warehouses): - [+](/reference/resource-configs/plus-prefix)[refresh_mode](#refresh-mode): AUTO | FULL | INCREMENTAL - [+](/reference/resource-configs/plus-prefix)[initialize](#initialize): ON_CREATE | ON_SCHEDULE - -``` - - - - - - - - - - -```yaml -version: 2 - -models: - - name: [] - config: - [materialized](/reference/resource-configs/materialized): dynamic_table - [on_configuration_change](/reference/resource-configs/on_configuration_change): apply | continue | fail - [target_lag](#target-lag): downstream | - [snowflake_warehouse](#configuring-virtual-warehouses): - [refresh_mode](#refresh-mode): AUTO | FULL | INCREMENTAL - [initialize](#initialize): ON_CREATE | ON_SCHEDULE - -``` - - - - - - - - - - -```jinja - -{{ config( - [materialized](/reference/resource-configs/materialized)="dynamic_table", - [on_configuration_change](/reference/resource-configs/on_configuration_change)="apply" | "continue" | "fail", - [target_lag](#target-lag)="downstream" | " seconds | minutes | hours | days", - [snowflake_warehouse](#configuring-virtual-warehouses)="", - [refresh_mode](#refresh-mode)="AUTO" | "FULL" | "INCREMENTAL", - [initialize](#initialize)="ON_CREATE" | "ON_SCHEDULE", - -) }} - -``` - - - - - - - - - -Learn more about these parameters in Snowflake's [docs](https://docs.snowflake.com/en/sql-reference/sql/create-dynamic-table): - -### Target lag - -Snowflake allows two configuration scenarios for scheduling automatic refreshes: -- **Time-based** — Provide a value of the form ` { seconds | minutes | hours | days }`. For example, if the dynamic table needs to be updated every 30 minutes, use `target_lag='30 minutes'`. -- **Downstream** — Applicable when the dynamic table is referenced by other dynamic tables. In this scenario, `target_lag='downstream'` allows for refreshes to be controlled at the target, instead of at each layer. - -Learn more about `target_lag` in Snowflake's [docs](https://docs.snowflake.com/en/user-guide/dynamic-tables-refresh#understanding-target-lag). - - - -### Refresh mode - -Snowflake allows three options for refresh mode: -- **AUTO** — Enforces an incremental refresh of the dynamic table by default. If the `CREATE DYNAMIC TABLE` statement does not support the incremental refresh mode, the dynamic table is automatically created with the full refresh mode. -- **FULL** — Enforces a full refresh of the dynamic table, even if the dynamic table can be incrementally refreshed. -- **INCREMENTAL** — Enforces an incremental refresh of the dynamic table. If the query that underlies the dynamic table can’t perform an incremental refresh, dynamic table creation fails and displays an error message. - -Learn more about `refresh_mode` in [Snowflake's docs](https://docs.snowflake.com/en/user-guide/dynamic-tables-refresh). - -### Initialize - -Snowflake allows two options for initialize: -- **ON_CREATE** — Refreshes the dynamic table synchronously at creation. If this refresh fails, dynamic table creation fails and displays an error message. -- **ON_SCHEDULE** — Refreshes the dynamic table at the next scheduled refresh. - -Learn more about `initialize` in [Snowflake's docs](https://docs.snowflake.com/en/user-guide/dynamic-tables-refresh). - - - -### Limitations - -As with materialized views on most data platforms, there are limitations associated with dynamic tables. Some worth noting include: - -- Dynamic table SQL has a [limited feature set](https://docs.snowflake.com/en/user-guide/dynamic-tables-tasks-create#query-constructs-not-currently-supported-in-dynamic-tables). -- Dynamic table SQL cannot be updated; the dynamic table must go through a `--full-refresh` (DROP/CREATE). -- Dynamic tables cannot be downstream from: materialized views, external tables, streams. -- Dynamic tables cannot reference a view that is downstream from another dynamic table. - -Find more information about dynamic table limitations in Snowflake's [docs](https://docs.snowflake.com/en/user-guide/dynamic-tables-tasks-create#dynamic-table-limitations-and-supported-functions). - -For dbt limitations, these dbt features are not supported: -- [Model contracts](/docs/collaborate/govern/model-contracts) -- [Copy grants configuration](/reference/resource-configs/snowflake-configs#copying-grants) - - - -#### Changing materialization to and from "dynamic_table" - -Version `1.6.x` does not support altering the materialization from a non-dynamic table be a dynamic table and vice versa. -Re-running with the `--full-refresh` does not resolve this either. -The workaround is manually dropping the existing model in the warehouse prior to calling `dbt run`. -This only needs to be done once for the conversion. - -For example, assume for the example model below, `my_model`, has already been materialized to the underlying data platform via `dbt run`. -If the model config is updated to `materialized="dynamic_table"`, dbt will return an error. -The workaround is to execute `DROP TABLE my_model` on the data warehouse before trying the model again. - - - -```yaml - -{{ config( - materialized="table" # or any model type (e.g. view, incremental) -) }} - -``` - - - - - ## Source freshness known limitation Snowflake calculates source freshness using information from the `LAST_ALTERED` column, meaning it relies on a field updated whenever any object undergoes modification, not only data updates. No action must be taken, but analytics teams should note this caveat.