tiagovrtr commented on a change in pull request #3880: [AIRFLOW-461] Support
autodetected schemas in BigQuery run_load
URL: https://github.com/apache/incubator-airflow/pull/3880#discussion_r241785164
##########
File path: airflow/contrib/operators/gcs_to_bq.py
##########
@@ -190,20 +191,24 @@ def __init__(self,
self.src_fmt_configs = src_fmt_configs
self.time_partitioning = time_partitioning
self.cluster_fields = cluster_fields
+ self.autodetect = autodetect
def execute(self, context):
bq_hook = BigQueryHook(bigquery_conn_id=self.bigquery_conn_id,
delegate_to=self.delegate_to)
- if not self.schema_fields and \
- self.schema_object and \
- self.source_format != 'DATASTORE_BACKUP':
- gcs_hook = GoogleCloudStorageHook(
- google_cloud_storage_conn_id=self.google_cloud_storage_conn_id,
- delegate_to=self.delegate_to)
- schema_fields = json.loads(gcs_hook.download(
- self.bucket,
- self.schema_object).decode("utf-8"))
+ if not self.schema_fields:
+ if self.schema_object and self.source_format != 'DATASTORE_BACKUP':
+ gcs_hook = GoogleCloudStorageHook(
+
google_cloud_storage_conn_id=self.google_cloud_storage_conn_id,
+ delegate_to=self.delegate_to)
+ schema_fields = json.loads(gcs_hook.download(
Review comment:
schema_fields local variable gets set in this condition path, but if
autodetect=True and self.schema_fields=None, the local variable schema_fields
doesn't get defined for the L239 argument passing
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services