Using GCSToBigQueryOperator this error occur
Broken DAG: [/opt/airflow/dags/injest_data.py] Traceback (most recent call last):
File "/opt/airflow/dags/injest_data.py", line 79, in <module>
> "sourceUris": [f"gs://{BUCKET_NAME}/*"],
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/models/baseoperator.py", line 397, in apply_defaults
raise AirflowException(f"missing keyword arguments {display}")
airflow.exceptions.AirflowException: missing keyword arguments 'bucket', 'destination_project_dataset_table','source_objects'****
And when i tried to change to BigQueryCreateExternalTableOperator This other error occur
Broken DAG: [/opt/airflow/dags/injest_data.py] Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/models/baseoperator.py", line 411, in apply_defaults
result = func(self, **kwargs, default_args=default_args)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/models/baseoperator.py", line 760, in __init__
f"Invalid arguments were passed to {self.__class__.__name__} (task_id: {task_id}). "
airflow.exceptions.AirflowException: Invalid arguments were passed to BigQueryCreateExternalTableOperator (task_id: bq_external_table_task). Invalid arguments were:
**kwargs: {'tables_resouces': {'tableReferences': {'projectId': 'de-projects-373304', 'datasetId': 'stockmarket_dataset', 'tableId': 'stockmarket_ex
Thanks in advance for your help...
I have tried to change the google query operators and even try to used different method to upload the data to bigquery but says schema dont exist, please i need help to understand what am doing wrong. Thanks in advance for your help, below is the code causing the error
bq_external_table_task = BigQueryCreateExternalTableOperator(
task_id = "bq_external_table_task",
tables_resouces = {
"tableReferences": {
"projectId": PROJECT_ID,
"datasetId": BIGQUERY_DATASET,
"tableId":f"{DATASET}_external_table",
},
"externalDataConfiguration": {
"autodetect": True,
"sourceFormat": f"{INPUT_FILETYPE.upper()}",
"sourceUris": [f"gs://{BUCKET_NAME}/*"],
},
},
)
There is no sourceUris
named parameter in GCSToBigQueryOperator . It should have source_objects
. Kindly check the operator's parameters from below official document: GCSToBigQueryOperator
Your BigQueryCreateExternalTableOperator has also wrong parameter names. tables_resouces
should have table_resource
. You can also check this operator's parameters from official document: BigQueryCreateExternalTableOperator
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.