You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/08/27 02:12:36 UTC

[airflow] branch main updated: Use project_id to get authenticated client (#25984)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new d4eb60712d Use project_id to get authenticated client (#25984)
d4eb60712d is described below

commit d4eb60712dc7bb34960ae10b9e6dd8624a554dfc
Author: Phani Kumar <94...@users.noreply.github.com>
AuthorDate: Sat Aug 27 07:42:29 2022 +0530

    Use project_id to get authenticated client (#25984)
---
 airflow/providers/google/cloud/hooks/bigquery.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/airflow/providers/google/cloud/hooks/bigquery.py b/airflow/providers/google/cloud/hooks/bigquery.py
index 731cd6364b..6776942fc5 100644
--- a/airflow/providers/google/cloud/hooks/bigquery.py
+++ b/airflow/providers/google/cloud/hooks/bigquery.py
@@ -448,12 +448,13 @@ class BigQueryHook(GoogleBaseHook, DbApiHook):
             dataset_reference["datasetReference"][param] = value
 
         location = location or self.location
+        project_id = project_id or self.project_id
         if location:
             dataset_reference["location"] = dataset_reference.get("location", location)
 
         dataset: Dataset = Dataset.from_api_repr(dataset_reference)
         self.log.info('Creating dataset: %s in project: %s ', dataset.dataset_id, dataset.project)
-        dataset_object = self.get_client(location=location).create_dataset(
+        dataset_object = self.get_client(project_id=project_id, location=location).create_dataset(
             dataset=dataset, exists_ok=exists_ok
         )
         self.log.info('Dataset created successfully.')