Google-api-python-client: error 400 parameter is missing but it doesn't says what

Created on 16 Apr 2019  路  4Comments  路  Source: googleapis/google-api-python-client

I'm trying to export table from BigQuery to Storage using Airflow:


CONNECTION_ID = Variable.get("gcp_connection_id")
gcs_export_uri_template = 'gs://bucket/folder/file.csv'
table_to_csv_op = BigQueryToCloudStorageOperator(
                    task_id='table_to_csv_task',
                    source_project_dataset_table=table_name_template,
                    destination_cloud_storage_uris=gcs_export_uri_template,
                    export_format='CSV',
                    field_delimiter=',',
                    print_header=False,
                    bigquery_conn_id=CONNECTION_ID,
                    dag=dag)

The lib raises exception:

INFO - Subtask: Traceback (most recent call last):
INFO - Subtask:   File "/usr/local/bin/airflow", line 27, in <module>
INFO - Subtask:     args.func(args)
INFO - Subtask:   File "/usr/local/lib/python2.7/dist-packages/airflow/bin/cli.py", line 392, in run
INFO - Subtask:     pool=args.pool,
INFO - Subtask:   File "/usr/local/lib/python2.7/dist-packages/airflow/utils/db.py", line 50, in wrapper
INFO - Subtask:     result = func(*args, **kwargs)
INFO - Subtask:   File "/usr/local/lib/python2.7/dist-packages/airflow/models.py", line 1488, in _run_raw_task
INFO - Subtask:     result = task_copy.execute(context=context)
INFO - Subtask:   File "/usr/local/lib/python2.7/dist-packages/airflow/contrib/operators/bigquery_to_gcs.py", line 95, in execute
INFO - Subtask:     self.print_header)
INFO - Subtask:   File "/usr/local/lib/python2.7/dist-packages/airflow/contrib/hooks/bigquery_hook.py", line 316, in run_extract
INFO - Subtask:     return self.run_with_configuration(configuration)
INFO - Subtask:   File "/usr/local/lib/python2.7/dist-packages/airflow/contrib/hooks/bigquery_hook.py", line 560, in run_with_configuration
INFO - Subtask:     .insert(projectId=self.project_id, body=job_data) \
INFO - Subtask:   File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 137, in positional_wrapper
INFO - Subtask:     return wrapped(*args, **kwargs)
INFO - Subtask:   File "/usr/local/lib/python2.7/dist-packages/googleapiclient/http.py", line 842, in execute
INFO - Subtask:     raise HttpError(resp, content, uri=self.uri)
INFO - Subtask: googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/bigquery/v2/projects/comp-data/jobs?alt=json returned "Required parameter is missing">

It doesn't say what is missing. What is the parameter that causes the problem?

I should note I have no problem with loading from Storage to BigQuery.

p2 bug

Most helpful comment

Found the problem it should be:
destination_cloud_storage_uris=[gcs_export_uri_template]

In any case I still think the library should raise a better error message explaining in which parameter there is a problem.

All 4 comments

Found the problem it should be:
destination_cloud_storage_uris=[gcs_export_uri_template]

In any case I still think the library should raise a better error message explaining in which parameter there is a problem.

cc @leahecole Some feedback on the Airflow operator for BigQuery.

The error message should have more details with #739.

I spent a lot of time this morning trying to replicate this error and couldn't because there was lots of detail as a result of #739 (thanks @busunkim96) , so I believe this can be resolved @tswast

Was this page helpful?
0 / 5 - 0 ratings