diff --git a/.changes/unreleased/Fixes-20231025-223003.yaml b/.changes/unreleased/Fixes-20231025-223003.yaml new file mode 100644 index 000000000..ebec94a30 --- /dev/null +++ b/.changes/unreleased/Fixes-20231025-223003.yaml @@ -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" diff --git a/dbt/adapters/bigquery/relation_configs/_options.py b/dbt/adapters/bigquery/relation_configs/_options.py index 51774e3fb..72f9d73e6 100644 --- a/dbt/adapters/bigquery/relation_configs/_options.py +++ b/dbt/adapters/bigquery/relation_configs/_options.py @@ -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 diff --git a/dbt/include/bigquery/macros/relations/materialized_view/refresh.sql b/dbt/include/bigquery/macros/relations/materialized_view/refresh.sql index 82bf819cd..40ad59f7b 100644 --- a/dbt/include/bigquery/macros/relations/materialized_view/refresh.sql +++ b/dbt/include/bigquery/macros/relations/materialized_view/refresh.sql @@ -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 %}