You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/02/27 12:29:37 UTC

[GitHub] mik-laj commented on a change in pull request #4785: [AIRFLOW-3965] Fixing GoogleCloudStorageToBigQueryOperator failing for jobs outside US and EU

mik-laj commented on a change in pull request #4785: [AIRFLOW-3965] Fixing GoogleCloudStorageToBigQueryOperator failing for jobs outside US and EU
URL: https://github.com/apache/airflow/pull/4785#discussion_r260726148
 
 

 ##########
 File path: airflow/contrib/operators/gcs_to_bq.py
 ##########
 @@ -196,10 +199,16 @@ def __init__(self,
         self.time_partitioning = time_partitioning
         self.cluster_fields = cluster_fields
         self.autodetect = autodetect
+        self.location = location
 
     def execute(self, context):
-        bq_hook = BigQueryHook(bigquery_conn_id=self.bigquery_conn_id,
-                               delegate_to=self.delegate_to)
+        bq_hook_params = {
+            'bigquery_conn_id': self.bigquery_conn_id,
+            'delegate_to': self.delegate_to
+        }
+        if self.location:
+            bq_hook_params['location'] = self.location
+        bq_hook = BigQueryHook(**bq_hook_params)
 
 Review comment:
   The `location` parameter is optional, so you can write:
   ```python
   bq_hook = BigQueryHook(
       bigquery_conn_id=self.bigquery_conn_id,	    
       delegate_to=self.delegate_to,
       location=self.location
   )
   ````

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services