我正在尝试通过 API 将 bigquery 数据导出到谷歌云存储桶。我从这里改编了一个代码片段https://cloud.google.com/bigquery/docs/exporting-data
Job job = table.extract(format, gcsUrl);
// Wait for the job to complete
try {
Job completedJob = job.waitFor(WaitForOption.checkEvery(1,
TimeUnit.SECONDS),
WaitForOption.timeout(3, TimeUnit.MINUTES));
if (completedJob != null && completedJob.getStatus().getError() == null) {
// Job completed successfully
} else {
// Handle error case
System.out.println(completedJob.getStatus().getError());
}
} catch (InterruptedException | TimeoutException e) {
// Handle interrupted wait
}
我已与“JSON”交换格式,因为我的数据是嵌套的,无法使用“gs://mybucket/export_*.json”导出到 CSV 和 gcsUrl。
但错误消息告诉我以下问题:
transfer not working BigQueryError{reason=invalid, location=null, message=Operation cannot be performed on a nested schema. Field: totals}
有什么建议吗? JSON 应该能够处理嵌套格式......
参考目的地格式选项,你应该设置"NEWLINE_DELIMITED_JSON"
为了format
变量以便导出为 JSON。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)