fix: missing column comments after ALTER VIEW AS#1444
Open
canbekley wants to merge 1 commit intodatabricks:mainfrom
Open
fix: missing column comments after ALTER VIEW AS#1444canbekley wants to merge 1 commit intodatabricks:mainfrom
canbekley wants to merge 1 commit intodatabricks:mainfrom
Conversation
3 tasks
Signed-off-by: Can Bekleyici <can.bekleyici@deepl.com>
62e688f to
c02466f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1357
Split out from #1358 per maintainer request to land independently of the #1356 behavior change.
Description
When
view_update_via_alteris enabled and the alter path issuesALTER VIEW <view> AS <query>,Databricks silently drops every persisted column comment. The existing
if column_commentsblockin
databricks__alter_viewdoesn't catch this because the column-comment diff is computed againstthe pre-alter state — when model and existing comments match, the diff is empty, so nothing
reapplies them after
ALTER VIEW ASwipes them.Fix: inside the
querybranch ofdatabricks__alter_view, reapply persisted column commentsafter
alter_query, gated onconfig.persist_column_docs()andmodel.columns. The patternmirrors
databricks__persist_docs(dbt/include/databricks/macros/adapters/persist_docs.sql).The existing
if column_commentsblock is kept — it still handles the disjoint case where only acolumn description changed in
schema.yml(no query change, so the new reapply path doesn't run).This fix becomes load-bearing once #1356 lands and
ALTER VIEW ASruns on every invocation, butthe bug exists today on any query change and is worth fixing standalone.
Checklist
CHANGELOG.mdand added information about my change to the"dbt-databricks next" section.