我正在尝试使用以下示例代码插入一行:
https://developers.google.com/bigquery/streaming-data-into-bigquery#streaminginsertexamples https://developers.google.com/bigquery/streaming-data-into-bigquery#streaminginsertexamples
TableRow row = new TableRow();
row.set("Col1", 50);
row.set("Col2", 50);
TableDataInsertAllRequest.Rows rows = new TableDataInsertAllRequest.Rows();
rows.setInsertId("" + System.currentTimeMillis());
rows.setJson(row);
List rowList = new ArrayList();
rowList.add(rows);
TableDataInsertAllRequest content = new TableDataInsertAllRequest().setRows(rowList);
try
{
TableDataInsertAllResponse response =
bigquery
.tabledata()
.insertAll("<myprojectid>", "6bc2cf53x8684x42a4x8149x9ff20fa8beed", "TestTable", content)
.execute();
System.out.println("Response: " + response);
}
catch (IOException e)
{
// handle
}
架构是这样的:
Col1 INTEGER NULLABLE
Col2 INTEGER NULLABLE
我收到错误:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 500
{
"code" : 500,
"errors" : [ {
"domain" : "global",
"message" : "Unexpected. Please try again.",
"reason" : "internalError"
} ],
"message" : "Unexpected. Please try again."
}
项目存在,数据集存在,表存在,数据类型与列规范匹配,并且我正在使用示例代码。 Jordan 在这个问题上表示 [1] 500 表示 BigQuery 存在 bug。我不介意解决它(如果是这样的话),但我不知道该怎么做。我可以尝试什么?我已经为每一列硬编码了简单值,我尝试了不同的表,我尝试了不同的全新项目/数据集/表集。相同的结果。
这既适用于开发环境,也适用于 GAE 环境。
如果有帮助:
项目编号:1066943214796(注意我没有使用它,我在调用中使用字符串 id),datasetid 和 table now 在上面的代码中。
[1] 使用服务帐户请求 google big query API 时出现 HTTP 错误 500 https://stackoverflow.com/questions/18662538/http-error-500-when-requesting-google-big-query-api-using-service-account