Skip to content

fix: refresh materialized_view when databricks_tags is set (#1419)#1424

Open
sd-db wants to merge 2 commits intomainfrom
sd-db/fix/issue-1419-mv-refresh-with-tags
Open

fix: refresh materialized_view when databricks_tags is set (#1419)#1424
sd-db wants to merge 2 commits intomainfrom
sd-db/fix/issue-1419-mv-refresh-with-tags

Conversation

@sd-db
Copy link
Copy Markdown
Collaborator

@sd-db sd-db commented Apr 25, 2026

Fixes #1419. MVs configured with databricks_tags were silently going stale on dbt run — only ALTER ... SET TAGS was issued, never REFRESH MATERIALIZED VIEW.

MaterializedViewAPI._describe_relation was the only *API._describe_relation not fetching information_schema.tags, so existing tags always parsed as {}. Any model with databricks_tags produced a spurious tag diff that routed the build to the alter path instead of refresh. One-line fix mirroring ViewAPI / IncrementalTableAPI.

Test plan

  • New functional test + unit regression guard
  • Full MV functional suite green (21/21) on serverless SQL warehouse
  • Full unit suite green (742 passed)

@sd-db sd-db self-assigned this Apr 25, 2026
MaterializedViewAPI._describe_relation was missing the information_schema.tags
fetch that ViewAPI and IncrementalTableAPI both perform. Existing MV tags
therefore always parsed as empty, causing get_changeset to report a spurious
tag diff for any model declaring databricks_tags. The non-None changeset
short-circuited the refresh branch in the materialized_view materialization
macro, routing it to ALTER ... SET TAGS instead of REFRESH MATERIALIZED VIEW.
MV data went silently stale while dbt reported success.

Adds the missing fetch_tags call and a TDD-style functional test plus a unit
regression guard.
@sd-db sd-db force-pushed the sd-db/fix/issue-1419-mv-refresh-with-tags branch from 81f0018 to 00cd608 Compare April 25, 2026 21:14
@sd-db
Copy link
Copy Markdown
Collaborator Author

sd-db commented Apr 25, 2026

/integration-test

@github-actions
Copy link
Copy Markdown

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

@github-actions
Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

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

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

@github-actions
Copy link
Copy Markdown

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

Run details.

@github-actions
Copy link
Copy Markdown

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

Run details.

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.

materialized_view materialization does not refresh data when no configuration changes are detected (only re-applies tags/grants)

1 participant