From 2fd263132924aafbffad126bb7b785e865560e41 Mon Sep 17 00:00:00 2001 From: Alex-Krykun Date: Thu, 30 Jan 2025 13:37:46 -0800 Subject: [PATCH] Add bq job labels to job configs --- dbt/adapters/bigquery/connections.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbt/adapters/bigquery/connections.py b/dbt/adapters/bigquery/connections.py index bb062f330..a525a0419 100644 --- a/dbt/adapters/bigquery/connections.py +++ b/dbt/adapters/bigquery/connections.py @@ -424,6 +424,7 @@ def copy_bq_table(self, source, destination, write_disposition) -> None: destination_ref = self.table_ref( destination.database, destination.schema, destination.table ) + labels = self.get_labels_from_query_comment() logger.debug( 'Copying table(s) "{}" to "{}" with disposition: "{}"', @@ -440,7 +441,7 @@ def copy_bq_table(self, source, destination, write_disposition) -> None: copy_job = client.copy_table( source_ref_array, destination_ref, - job_config=CopyJobConfig(write_disposition=write_disposition), + job_config=CopyJobConfig(write_disposition=write_disposition, labels=labels), retry=self._retry.create_reopen_with_deadline(conn), ) copy_job.result(timeout=self._retry.create_job_execution_timeout(fallback=300))