【发布时间】:2016-12-01 16:09:13
【问题描述】:
我正在尝试将数据上传到 appengine 中的 bigquery。
这是我使用来自streaming sample的api的代码
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
String projectId = "myprojectId";
String datasetId = "mydatasetId";
String tableId = "person";
System.out.println("Enter JSON to stream to BigQuery: \n" + "Press End-of-stream (CTRL-D) to stop");
String string = "[\n {\"Name\": \"test\", \"Age\": 0, \"Weight\": 100.0, \"IsMagic\": false},\n {\"Name\": \"test\", \"Age\": 1, \"Weight\": 100.0, \"IsMagic\": false},\n {\"Name\": \"test\", \"Age\": 2, \"Weight\": 100.0, \"IsMagic\": false},\n {\"Name\": \"test\", \"Age\": 3, \"Weight\": 100.0, \"IsMagic\": false},\n {\"Name\": \"test\", \"Age\": 0, \"Weight\": 100.0, \"IsMagic\": false}\n]";
JsonReader jsonReader = new JsonReader(new StringReader(string));
Iterator<TableDataInsertAllResponse> responses = StreamingSample.run(projectId, datasetId, tableId, jsonReader);
while (responses.hasNext()) {
log.info(responses.next());
}
jsonReader.close();
}
现在我如何进行大查询ignoreUnknownValues? 有没有我可以使用的库?
【问题讨论】:
标签: java google-app-engine google-bigquery