Skip to content
Advertisement

How to load a BigQuery table from a file in GCS Bucket using Airflow?

I am new to Airflow, and I am wondering, how do I load a file from a GCS Bucket to BigQuery?

So far, I have managed to do BigQuery to GCS Bucket:

JavaScript

Can someone help me to modify my current code, so I can load a file from a GCS Bucket and load it to BigQuery?

Advertisement

Answer

For your requirement, you can use GCSToBigQueryOperator which is an operator in airflow to transfer files from Cloud Storage to BigQuery.For more information, check this link. You can try the below code.

gcs_to_bq_operator.py

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement