Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google BigQuery "bq" tool extracts nested/repeated records, how with Java's API?

I've created a Google BigQuery table with five nested/repeated records, when I try queries ...bigquery.jobs().query(projectId, queryRequest).execute();... then ...queryResponse.getRows()..., BigQuery returns a flat json.
I've seen that the python bq --extract tool, is able to return pretty well the json. This json, effectively, is exactly the json that I've loaded. How is it possible with Java's API? Can someone help me, please? Thanks Onofrio

like image 693
nofaruccio Avatar asked Oct 20 '22 15:10

nofaruccio


1 Answers

BigQuery flattens the results of all queries. We've had a feature request for a while to provide the option to not flatten query results, and we may add support for this in the future.

If you want to read nested data from a table, however, you can use bigquery.tabledata().list(...), which will return nested/repeated json.

like image 147
Jordan Tigani Avatar answered Oct 31 '22 12:10

Jordan Tigani