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

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

前提任務

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

運算子

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

使用 Jinja 模板化(Jinja templating) 配合 source_project_dataset_tabledestination_cloud_storage_urisexport_formatlabelsimpersonation_chainjob_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}"],
)

參考

更多資訊,請參閱:

此條目有用嗎?