[英]How to do streaming insert data from one bigquery table to another table after flattening the nested fields?
[英]BigQuery async streaming data to one table
我使用tabledata().insertAll(
)方法将数据流式传输到BigQuery。 数据从TaskQueue发送,异步数据将并发数据发送到一个表。 所有通过都成功,但是在给定表中并非所有数据都可用。
我的问题是如何异步将数据导出到BigQuery?
我使用以下代码将数据导出到BigQuery:
val content = TableDataInsertAllRequest().setRows(requestRows)
val tabledata = bigquery.tabledata()
var response: TableDataInsertAllResponse
try {
response = tabledata.insertAll(projectId, dataset, table, content).execute()
var insertErrors: List<TableDataInsertAllResponse.InsertErrors>? = response.insertErrors
if (insertErrors != null && insertErrors.isNotEmpty()) {
val errors = insertErrors.map { "${it.index} ${it.errors[0].reason} ${it.errors[0].message}" }.joinToString { "\n" }
log.info(errors)
throw RuntimeException("Streaming rows to BigQuery dataset $dataset table $table fails")
}
}
log.info("streaming finish")
} catch (e: IOException) {
throw RuntimeException(e)
}
我怀疑您没有正确设置insertId
并且在流传输阶段删除了数据。 确保对于每个唯一行,您都有不同的insertId
。
有一个流缓冲阶段,一旦所有内部节点完成其处理,数据将被保留。
您可能会在网络界面上看到
该表在流缓冲区中具有记录,这些记录在预览中可能不可见。
在第一次将流插入表中后的几秒钟内,流数据可用于实时分析。 数据最多可能需要90分钟才能用于复制和导出操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.