Peter C.
Peter C.

Reputation: 51

Writing nested records from Java dataflow to 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?

Upvotes: 1

Views: 2265

Answers (1)

Peter C.
Peter C.

Reputation: 51

The link shared by @ElliotBrossard points towards a solution: https://sookocheff.com/post/bigquery/writing-repeated-bigquery-records/

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.

Upvotes: 4

Related Questions