Skip to content

fix: apply column_tags when updating a view via ALTER - #1526

Merged
sd-db merged 5 commits into
mainfrom
sd-db/fix/view-alter-column-tags
Jun 23, 2026
Merged

fix: apply column_tags when updating a view via ALTER#1526
sd-db merged 5 commits into
mainfrom
sd-db/fix/view-alter-column-tags

Conversation

@sd-db

@sd-db sd-db commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixes #1525.

A Unity Catalog view configured with view_update_via_alter: true and column-level databricks_tags failed on a subsequent dbt run whose only change was its column tags, erroring with Runtime Error … main is not being called during running model.

databricks__alter_view handled tags/tblproperties/query/column_comments from the configuration changeset but had no column_tags branch — while ViewConfig.config_components includes ColumnTagsProcessor and a column-tags-only change does not set requires_full_refresh, so it routes to alter_view rather than a full replace. With column tags as the only change, the macro became a no-op that never called statement('main').

This adds the column_tags branch to databricks__alter_view (mirroring the table/incremental paths), so the changed tags are applied on the alter path, matching the view create path.

Testing

  • TestColumnTagsViewUpdateViaAlter (functional): a V2 view with view_update_via_alter: true whose only second-run change is its column tags now applies them, asserted via system.information_schema.column_tags. Errored before the fix, passes after.
  • test_macros__alter_view_with_column_tags (unit): alter_view calls apply_column_tags when the changeset carries a column_tags entry, and not otherwise.

@sd-db
sd-db requested a review from jprakash-db as a code owner June 16, 2026 10:05
A V2 view with view_update_via_alter: true errored with "main is not
being called during running model" on a run whose only change was its
column tags: databricks__alter_view had no column_tags branch, so the
alter macro became a no-op that never called statement('main'). Add the
branch so the changed column tags are applied on the alter path, matching
the view create path and the table/incremental paths.

Closes #1525
@sd-db
sd-db force-pushed the sd-db/fix/view-alter-column-tags branch from 99d88c1 to cb9c5ec Compare June 16, 2026 10:05
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  dbt/adapters/databricks
  impl.py 1447-1448
Project Total  

This report was generated by python-coverage-comment-action

@sd-db

sd-db commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

/integration-test

@github-actions

Copy link
Copy Markdown

Integration tests dispatched for PR #1526 by @sd-db. Track progress in the Actions tab.

@github-actions

Copy link
Copy Markdown

Integration results for PR #1526 — UC cluster ❌ failure · SQL warehouse ❌ failure · All-purpose cluster ✅ success · Shard coverage ✅ success

Run details.

@sd-db

sd-db commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

/integration-test

@github-actions

Copy link
Copy Markdown

Integration tests dispatched for PR #1526 by @sd-db. Track progress in the Actions tab.

@github-actions

Copy link
Copy Markdown

Integration results for PR #1526 — UC cluster ✅ success · SQL warehouse ✅ success · All-purpose cluster ✅ success · Shard coverage ✅ success

Run details.

sd-db added 3 commits June 18, 2026 14:18
ViewAPI._describe_relation now loads server column tags so view_update_via_alter runs no-op once tags match, with unit and functional test coverage.
@sd-db
sd-db merged commit d295199 into main Jun 23, 2026
9 checks passed
@sd-db
sd-db deleted the sd-db/fix/view-alter-column-tags branch June 23, 2026 06:09
sd-db added a commit to canbekley/dbt-databricks that referenced this pull request Jun 24, 2026
Resolve conflict in tests/unit/macros/relations/test_view_macros.py by
keeping both additions: this branch's alter_column_comment mock + the
reapplies_column_comments test, and main's (databricks#1526) apply_column_tags mock
+ the column_tags test. They are independent.

Relocate the databricks#1357 CHANGELOG entry out of the now-released 1.11.8 section
into the current 1.12.2 (TBD) Fixes section (main has since released
1.11.8/1.12.0/1.12.1).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

View column tags not applied on the ALTER update path (view_update_via_alter: true) → "main is not being called" error

2 participants