diff --git a/airflow/contrib/hooks/bigquery_hook.py b/airflow/contrib/hooks/bigquery_hook.py index e324ffb4a75a6..d70a629ccc484 100644 --- a/airflow/contrib/hooks/bigquery_hook.py +++ b/airflow/contrib/hooks/bigquery_hook.py @@ -225,11 +225,16 @@ def run_extract(self, source_dataset_table, destination_cloud_storage_uris, comp 'compression': compression, 'destinationUris': destination_cloud_storage_uris, 'destinationFormat': export_format, - 'fieldDelimiter': field_delimiter, - 'printHeader': print_header, } } + if export_format == 'CSV': + # Only set fieldDelimiter and printHeader fields if using CSV. + # Google does not like it if you set these fields for other export + # formats. + configuration['extract']['fieldDelimiter'] = field_delimiter + configuration['extract']['printHeader'] = print_header + return self.run_with_configuration(configuration) def run_copy(self, source_dataset_tables, destination_project_dataset_table, write_disposition='WRITE_EMPTY', create_disposition='CREATE_IF_NEEDED'):