From 7458f1e7861e5146da61cbff9393d72c88a3608c Mon Sep 17 00:00:00 2001 From: Chuan Qiu <35706996+c-nuro@users.noreply.github.com> Date: Sat, 18 Sep 2021 10:00:27 -0700 Subject: [PATCH] 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 5a9edc827918e..065b473b747b2 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 @@ def execute(self, context): 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