【发布时间】:2025-12-15 07:10:02
【问题描述】:
我正在尝试通过 API 将 bigquery 数据导出到谷歌云存储桶。我从这里改编了一个代码 sn-p 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”交换格式,因为我的数据是嵌套的,无法导出到 CSV 和带有“gs://mybucket/export_*.json”的 gcsUrl。 但是错误消息告诉我以下问题:
transfer not working BigQueryError{reason=invalid, location=null, message=Operation cannot be performed on a nested schema. Field: totals}
有什么建议吗? JSON 应该能够处理嵌套格式...
【问题讨论】:
-
在您的代码中,
format是如何定义的? -
对于我使用 JSON 的格式
标签: java json google-cloud-datastore google-bigquery google-cloud-platform