From d219af2049c1b89c4983ceb13e305e1906e493fa Mon Sep 17 00:00:00 2001 From: Matthew McKnight Date: Fri, 22 Sep 2023 15:28:21 -0500 Subject: [PATCH] initital attempt at modifying get_alter_materialized_view_as_sql --- .../macros/relations/materialized_view/alter.sql | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dbt/include/bigquery/macros/relations/materialized_view/alter.sql b/dbt/include/bigquery/macros/relations/materialized_view/alter.sql index 8204c87ba..dfb7d46d3 100644 --- a/dbt/include/bigquery/macros/relations/materialized_view/alter.sql +++ b/dbt/include/bigquery/macros/relations/materialized_view/alter.sql @@ -6,10 +6,18 @@ ) %} {% if configuration_changes.requires_full_refresh %} + {{ get_replace_sql(existing_relation, relation, sql) }} + {% else %} - {{ bigquery__get_replace_materialized_view_as_sql(relation, sql) }} + {%- set auto_refresh = configuration_changes.auto_refresh -%} + {%- if auto_refresh -%}{{- log('Applying UPDATE AUTOREFRESH to: ' ~ relation) -}}{%- endif -%} - {% else %} + alter materialized view {{ relation }} + set options ( + {% if auto_refresh %}enable_refresh = {{ auto_refresh.context }}{% endif %} + ) + + {%- endif %} {% endmacro %}