From 44854db7b3b95ce5d83636c2d7761bdecf46b9ae Mon Sep 17 00:00:00 2001 From: Ben Cassell <98852248+benc-db@users.noreply.github.com> Date: Wed, 25 Sep 2024 09:13:06 -0700 Subject: [PATCH] Stop setting cluster by to None (#806) --- CHANGELOG.md | 6 +++++- .../databricks/macros/relations/liquid_clustering.sql | 8 +------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70204e605..5eac86895 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -## dbt-databricks TBD (TBD) +## dbt-databricks 1.8.7 (TBD) + +### Fixes + +- Stop setting cluster by to None. If you want to drop liquid clustering, you will need to full-refresh ([806]https://github.com/databricks/dbt-databricks/pull/806) ## dbt-databricks 1.8.6 (September 18, 2024) diff --git a/dbt/include/databricks/macros/relations/liquid_clustering.sql b/dbt/include/databricks/macros/relations/liquid_clustering.sql index 46c1bc625..3cf810488 100644 --- a/dbt/include/databricks/macros/relations/liquid_clustering.sql +++ b/dbt/include/databricks/macros/relations/liquid_clustering.sql @@ -9,19 +9,13 @@ {%- endmacro -%} {% macro apply_liquid_clustered_cols(target_relation) -%} - {%- set file_format = config.get('file_format', default='delta') -%} - {%- set partition_by = config.get('partition_by', validator=validation.any[list, basestring], default=None) -%} {%- set cols = config.get('liquid_clustered_by', validator=validation.any[list, basestring]) -%} {%- if cols is not none %} {%- if cols is string -%} {%- set cols = [cols] -%} - {%- endif -%} + {%- endif -%} {%- call statement('set_cluster_by_columns') -%} ALTER {{ target_relation.type }} {{ target_relation }} CLUSTER BY ({{ cols | join(', ') }}) {%- endcall -%} - {%- elif not target_relation.is_hive_metastore() and file_format == "delta" and not partition_by -%} - {%- call statement('unset_cluster_by_columns') -%} - ALTER {{ target_relation.type }} {{ target_relation }} CLUSTER BY NONE - {%- endcall -%} {%- endif %} {%- endmacro -%} \ No newline at end of file