使用BigQuery Jobs API复制多个BigQuery表 [英] Copy multiple BigQuery tables using BigQuery Jobs API

查看:79
本文介绍了使用BigQuery Jobs API复制多个BigQuery表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在BigQuery Jobs API中注意到了复制任务:



https://developers.google.com/bigquery/docs/reference/v2/jobs#resource



<对于sourceTables存在一个输入:

 copy:{
sourceTables:[

projectId:string,
datasetId:string,
tableId:string
}
],

然而,我们只能定义一个单独的destinationTable而不是destinationTables:

 destinationTable:{
projectId:string,
datasetId:string,
tableId:string
},

有没有一种方法可以使用上述API从一个数据集复制多个源表到另一个数据集?

解决方案

要创建多个目标表,您需要运行多个作业。如果您想一次完成这些操作,可以使用批量请求(文档用于HTTP API here 。Python文档此处和Java 此处


I noticed in BigQuery Jobs API for the Copy task:

https://developers.google.com/bigquery/docs/reference/v2/jobs#resource

there exists a input for "sourceTables":

"copy": {
  "sourceTables": [
    {
      "projectId": string,
      "datasetId": string,
      "tableId": string
    }
  ],

However we can only define a singular "destinationTable" rather than "destinationTables":

  "destinationTable": {
    "projectId": string,
    "datasetId": string,
    "tableId": string
  },

Is there a way I can use the above API to copy multiple source tables from one Dataset into another Dataset?

解决方案

To create multiple destination tables you'll need to run multiple jobs. If you want to do these all at once, you can use a batch request (docs for the HTTP API here. Python docs are here, and Java here.

这篇关于使用BigQuery Jobs API复制多个BigQuery表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆