fix: implicit view schema changes with alter view approach
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.mdand added information about my change to the "dbt-databricks next" section.
Thanks for the PR. Will look into it.
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.
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?