diff --git a/.changes/unreleased/Under the Hood-20240917-181147.yaml b/.changes/unreleased/Under the Hood-20240917-181147.yaml new file mode 100644 index 000000000..2f52174dd --- /dev/null +++ b/.changes/unreleased/Under the Hood-20240917-181147.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Change behavior flag semantics to log iceberg flag warnings.. +time: 2024-09-17T18:11:47.525026-07:00 +custom: + Author: versusfacit + Issue: "321" diff --git a/dbt/adapters/snowflake/impl.py b/dbt/adapters/snowflake/impl.py index a6297887d..69da11802 100644 --- a/dbt/adapters/snowflake/impl.py +++ b/dbt/adapters/snowflake/impl.py @@ -80,7 +80,18 @@ class SnowflakeAdapter(SQLAdapter): @property def _behavior_flags(self) -> List[BehaviorFlag]: - return [{"name": "enable_iceberg_materializations", "default": False}] + return [ + { + "name": "enable_iceberg_materializations", + "default": False, + "description": ( + "Enabling Iceberg materializations introduces latency to metadata queries, " + "specifically within the list_relations_without_caching macro. Since Iceberg " + "benefits only those actively using it, we've made this behavior opt-in to " + "prevent unnecessary latency for other users." + ), + } + ] @classmethod def date_function(cls): diff --git a/dbt/include/snowflake/macros/relations/table/create.sql b/dbt/include/snowflake/macros/relations/table/create.sql index 355150e28..e60b93039 100644 --- a/dbt/include/snowflake/macros/relations/table/create.sql +++ b/dbt/include/snowflake/macros/relations/table/create.sql @@ -1,4 +1,9 @@ {% macro snowflake__create_table_as(temporary, relation, compiled_code, language='sql') -%} + + {%- if relation.is_iceberg_format and not adapter.behavior.enable_iceberg_materializations.no_warn %} + {% do exceptions.raise_compiler_error('Was unable to create model as Iceberg Table Format. Please set the `enable_iceberg_materializations` behavior flag to True in your dbt_project.yml. For more information, go to .') %} + {%- endif %} + {%- set materialization_prefix = relation.get_ddl_prefix_for_create(config.model.config, temporary) -%} {%- set alter_prefix = relation.get_ddl_prefix_for_alter() -%}