Skip to content

Commit

Permalink
Fix refresh syntax, config comparison with empty labels (#983)
Browse files Browse the repository at this point in the history
* map an empty labels dict to none for comparison

* remove drop statement that isn't used

* fix refresh statement

* add drop materialized view back, it gets called by replace

* changelog
  • Loading branch information
mikealfare authored Oct 27, 2023
1 parent b8af6a6 commit f139e95
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20231025-223003.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fix refresh syntax, config comparison with empty labels
time: 2023-10-25T22:30:03.0034-04:00
custom:
Author: mikealfare
Issue: "983"
6 changes: 5 additions & 1 deletion dbt/adapters/bigquery/relation_configs/_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,12 @@ def parse_bq_table(cls, table: BigQueryTable) -> Dict[str, Any]:
"expiration_timestamp": table.expires,
"max_staleness": None,
"description": table.description,
"labels": table.labels,
}

# map the empty dict to None
if labels := table.labels:
config_dict.update({"labels": labels})

if encryption_configuration := table.encryption_configuration:
config_dict.update({"kms_key_name": encryption_configuration.kms_key_name})
return config_dict
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% macro bigquery__refresh_materialized_view(relation) %}
call bq.refresh_materialized_view('{{ relation }}')
call bq.refresh_materialized_view('{{ relation.database }}.{{ relation.schema }}.{{ relation.identifier }}')
{% endmacro %}

0 comments on commit f139e95

Please sign in to comment.