从appengine上传到bigquery时如何忽略未知值

时间:2016-12-01 16:09:13

标签: java google-app-engine google-bigquery

我试图将数据上传到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? 我可以使用任何图书馆吗?