dbt-databricks icon indicating copy to clipboard operation
dbt-databricks copied to clipboard

fix: implicit view schema changes with alter view approach

Open canbekley opened this issue 8 months ago • 3 comments

Resolves #1356

[!NOTE] Stacked on #1444 (resolves #1357), per maintainer request to split this work. please merge that PR first

Description

Views materialized with view_update_via_alter (v2 materialization) were skipping ALTER VIEW AS whenever dbt's query diff reported no change, so changes in underlying tables (e.g. a new column appearing in a select * source) never propagated to the view.

Fix: force ALTER VIEW AS <query> on every invocation by replacing QueryProcessor with a ViewQueryProcessor whose get_diff always returns self. Drop the no-op branch in the view materialization (always alter, never skip).

With #1357's reapply-after-alter_query block now in place, the existing ColumnCommentsProcessor is also removed from ViewConfig every alter-view run wipes column comments and reapplies them unconditionally, so a separate diff path is no longer needed.

Checklist

  • [x] I have run this code in development and it appears to resolve the stated issue
  • [x] This PR includes tests, or tests are not required/relevant for this PR
  • [x] I have updated the CHANGELOG.md and added information about my change to the "dbt-databricks next" section.

canbekley avatar Mar 13 '26 12:03 canbekley

Thanks for the PR. Will look into it.

tejassp-db avatar Apr 20 '26 10:04 tejassp-db

It looks like there are two different fixes - column comments and view refresh, in this PR. Can you please split it into two separate PRs?

good point, I should definitely split this in two separate PRs. there is going to be an order dependency though, as we would need to merge the column comment fix before the bahavioural changes that enforce ALTER VIEW AS invocations. I will create a new PR for the column comment fix.

canbekley avatar May 06 '26 21:05 canbekley

hi @tejassp-db , this PRs is now split into two dependent PRs: column comment fix in #1444 (which would need to be merged first) and the view schema refresh fix in the PR. I also updated the descriptions accordingly. could you please have another look?

canbekley avatar May 08 '26 09:05 canbekley