将 BigQuery 数据转移到 Amazon S3 存储桶

3

我有一个存储在Big Query中的模式,需要将其转移到Amazon S3存储桶中。这个操作的过程是什么? BigQuery数据属于另一个组织,他们愿意给予适当的访问权限来转移数据。我找到了从S3存储桶导入到GCP的方法,但没有直接从Big Query导出到S3的方法。我真的被卡住了。此外,我需要安排这个过程,因为BigQuery中的数据正在发生变化,我每天都想把数据发送到我的S3存储桶中。请提供相关参考资料。请注意,每天的数据量将达到TB级别。

2个回答

5
据我所知,目前没有直接从BigQuery到S3的管道,但可以通过将数据从BigQuery导出至Google Cloud Storage,再从Google Cloud Storage导入至S3来实现。
  1. First step is to setup gcloud sdk on the machine where the job would be scheduled.

  2. Configure gcloud and pay special attention to boto configuration you can skip this step if the process is going to run on an EC2 with a role attached that allows it to write to S3 (also a better security practice than using keys)

  3. copy data from bigquery to gcs

     bq --location=US extract --destination_format AVRO --compression SNAPPY [source_table] [target location on gcs]
    
  4. copy the file from gcs to s3

     gsutil rsync -r [target location on gcs] to [target location on s3]
    
注意:此过程适用于GA360数据,因为它已经按天分区,但如果不是这种情况并且您无法分离表,则可以在GCP上安排查询以创建具有增量逻辑的表,该表将用作[源表]。 更新 AWS发布了一个BQ 粘合剂连接器,可以做到这一点。

0
我想直接使用导出查询就可以实现这个: 参考: 将BigQuery数据传输到Amazon S3 Bucket 使用连接 CONNECTION_REGION.CONNECTION_NAME 导出数据
选项(uri="s3://BUCKET_NAME/PATH", format="FORMAT", ...)
作为查询运行

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接