Fix: Handle view materialization alterations#610
Open
axellpadilla wants to merge 1 commit intodbt-msft:masterfrom
Open
Fix: Handle view materialization alterations#610axellpadilla wants to merge 1 commit intodbt-msft:masterfrom
axellpadilla wants to merge 1 commit intodbt-msft:masterfrom
Conversation
This commit addresses the following: - Modifies the `create view` macro to use `alter view` when the view already exists, preventing errors during re-materialization. - Updates the view materialization logic to correctly handle scenarios where a table with the same name exists. It now renames the existing table to a backup before creating the view. - Adds a test case to verify that materializing an existing view updates its definition correctly, including column changes.
30a2bf6 to
18ea497
Compare
Contributor
Author
|
Hi @cody-scott , did you have any time to review this? Maybe you could authorize some extra hands to make reviews or even maintainers, thing is, on sql server a drop/create view are 2 steps and plenty of system tables modifications, while alter is 1 step and less overhead, this should be a high impact change for big dbt projects (it is for my use cases). |
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.
This commit addresses the following:
create viewmacro to usealter viewwhen the view already exists, preventing errors during re-materialization and non-dbt grants deletion.All tests passing.