Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assume deployed materialized views are unchanged during view deploys #4679

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bigquery_etl/view/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ def has_changes(self, target_project=None):
expected_view_query = CREATE_VIEW_PATTERN.sub(
"", sqlparse.format(self.content, strip_comments=True), count=1
).strip(";" + string.whitespace)

if table.view_query is None:
# Materialized views do not have view_query.
# Always assume they are unchanged since they can't be replaced anyway
return False
Comment on lines +258 to +261
Copy link
Contributor

@fbertsch fbertsch Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of special casing makes the codebase hard to reason about. Is there a way for us to prevent bqetl view publish from indexing materialized views to begin with?


actual_view_query = sqlparse.format(
table.view_query, strip_comments=True
).strip(";" + string.whitespace)
Expand Down