将嵌套记录从Java数据流写入BigQuery [英] Writing nested records from Java dataflow to BigQuery
问题描述
我有一些带有嵌套字段的对象,我想将这些数据从我的数据流作业写入BigQuery表中.我了解如何创建表架构,但看不到如何创建
I have some objects with nested fields that I want to write from my dataflow job into a BigQuery table. I understand how to create the table schema, but I don't see how to create a TableRow with nested fields.
The TableRow object is just a list of TableCell objects, which appear to be String,Object key-value pairs. How can I build a nested object this way? Can the value of a TableCell be a TableRow?
推荐答案
@ElliotBrossard共享的链接指向一个解决方案: https://sookocheff.com/post/bigquery/writing-repeated-bigquery-records/
The link shared by @ElliotBrossard points towards a solution: https://sookocheff.com/post/bigquery/writing-repeated-bigquery-records/
就像使用 List< TableRow>
表示重复的字段一样,使用 TableRow
表示嵌套的字段,其中某些字段值本身就是TableRow
对象.
Just as a repeated field is represented using a List<TableRow>
, a nested field is represented using a TableRow
where some of the field values are themselves TableRow
objects.
这篇关于将嵌套记录从Java数据流写入BigQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!