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 2021/09/18 17:00:49 UTC

[airflow] branch main updated: Remove check for at least one schema in GCSToBigquery (#18150)

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 7458f1e  Remove check for at least one schema in GCSToBigquery (#18150)
7458f1e is described below

commit 7458f1e7861e5146da61cbff9393d72c88a3608c
Author: Chuan Qiu <35...@users.noreply.github.com>
AuthorDate: Sat Sep 18 10:00:27 2021 -0700

    Remove check for at least one schema in GCSToBigquery (#18150)
    
    For the case when updating an existing table or insert data to a particular partition, no schema is needed.
    Autodetect doesn't always work, e.g. cannot distinguish partition correctly. Other options requires forking the schema to airflow.
---
 airflow/providers/google/cloud/transfers/gcs_to_bigquery.py | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py b/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py
index 5a9edc8..065b473 100644
--- a/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py
+++ b/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py
@@ -20,7 +20,6 @@
 import json
 from typing import Optional, Sequence, Union
 
-from airflow.exceptions import AirflowException
 from airflow.models import BaseOperator
 from airflow.providers.google.cloud.hooks.bigquery import BigQueryHook
 from airflow.providers.google.cloud.hooks.gcs import GCSHook
@@ -274,10 +273,6 @@ class GCSToBigQueryOperator(BaseOperator):
                     object_name=self.schema_object,
                 )
                 schema_fields = json.loads(blob.decode("utf-8"))
-            elif self.schema_object is None and self.autodetect is False:
-                raise AirflowException(
-                    'At least one of `schema_fields`, `schema_object`, or `autodetect` must be passed.'
-                )
             else:
                 schema_fields = None