Google Cloud BigQuery 傳輸運算子至 Google Cloud Storage

Google Cloud BigQuery 是 Google Cloud 的無伺服器資料倉儲服務。Google Cloud Storage (GCS) 是一種用於儲存非結構化資料的託管服務。此運算子可用於將資料從 BigQuery 表格匯出到 Cloud Storage 儲存桶中的檔案。

先決條件任務

要使用這些運算子,您必須執行以下幾項操作

運算子

從 BigQuery 匯出表格到 GCS 是透過 BigQueryToGCSOperator 運算子執行。

使用 Jinja 模板source_project_dataset_table, destination_cloud_storage_uris, export_format, labels, impersonation_chain, job_id 來動態定義值。

您可以定義多個目標 URI,以及其他設定,例如 compressionexport_format。有關更多資訊,請參閱上面的連結。

匯出表格

以下運算子將 BigQuery 表格匯出到 GCS。

tests/system/google/cloud/bigquery/example_bigquery_to_gcs.py[原始碼]

bigquery_to_gcs = BigQueryToGCSOperator(
    task_id="bigquery_to_gcs",
    source_project_dataset_table=f"{DATASET_NAME}.{TABLE}",
    destination_cloud_storage_uris=[f"gs://{BUCKET_NAME}/{BUCKET_FILE}"],
)

參考資料

如需更多資訊,請查看

此條目是否有幫助?