【发布时间】:2017-07-31 20:30:19
【问题描述】:
我正在尝试使用类似于this page 上的教程的 Java 驱动程序将数据流式传输到 BigQuery,该驱动程序将数据从地图插入到 BigQuery 表中。 The v2 of the streaming rest API 支持在插入时将行指定为 JSON,所以我想知道是否可以使用 Java 驱动程序将 JSON 流式传输到 bigquery,而不必像下面的示例那样使用映射。
Map<String, Object> rowContent = new HashMap<>();
rowContent.put("booleanField", true);
// Bytes are passed in base64
rowContent.put("bytesField", "Cg0NDg0="); // 0xA, 0xD, 0xD, 0xE, 0xD in base64
// Records are passed as a map
Map<String, Object> recordsContent = new HashMap<>();
recordsContent.put("stringField", "Hello, World!");
rowContent.put("recordField", recordsContent);
InsertAllResponse response = bigquery.insertAll(InsertAllRequest.newBuilder(tableId)
.addRow("rowId", rowContent)
// More rows can be added in the same RPC by invoking .addRow() on the builder
.build());
即有什么方法可以运行bigquery.insertAll,但传入一个 json 字符串而不是 Map?
【问题讨论】:
-
在 C# 中肯定有:cloud.google.com/bigquery/… 我不认为在 java 中,通过快速搜索找不到
标签: java json google-bigquery