Skip to content

Commit 5efb427

Browse files
authored
fix: apply column-level tags for V1 table materialization (#1346)
## Summary - Fixes #1307 — column-level `databricks_tags` were silently ignored for tables using the V1 (default) materialization path - The V1 table materialization was missing the `apply_column_tags()` call that the view, V2 table, streaming table, and materialized view materializations all have ## Test plan - [x] `TestColumnTagsTableV1` — Added V1-specific functional test - [x] Existing test suite passes;`TestColumnTagsTableV2` — confirms V2 path is unaffected, `TestColumnTagsViewV1` — confirms views still work correctly
1 parent 4698055 commit 5efb427

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

dbt/include/databricks/macros/materializations/table.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
{% endif %}
6464
{%- do apply_tags(target_relation, tags) -%}
6565

66+
{% set column_tags = adapter.get_column_tags_from_model(config.model) %}
67+
{% if column_tags and column_tags.set_column_tags %}
68+
{{ apply_column_tags(target_relation, column_tags) }}
69+
{% endif %}
70+
6671
{% do persist_docs(target_relation, model, for_relation=language=='python') %}
6772

6873
{% do persist_constraints(target_relation, model) %}

tests/functional/adapter/column_tags/test_column_tags.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,13 @@ def setup_streaming_table_seed(self, project):
9999
@pytest.mark.skip_profile("databricks_cluster")
100100
class TestColumnTagsView(ColumnTagsMixin):
101101
relation_type = "view"
102+
103+
104+
@pytest.mark.skip_profile("databricks_cluster")
105+
class TestColumnTagsTableV1(ColumnTagsMixin):
106+
relation_type = "table"
107+
108+
@pytest.fixture(scope="class")
109+
def project_config_update(self):
110+
# Override MaterializationV2Mixin to test the V1 (default) materialization path
111+
return {}

0 commit comments

Comments
 (0)