I've got a table in Google BigQuery which has repeated records in it, I've followed the guide at https://cloud.google.com/bigquery/docs/nested-repeated to create the table successfully and I've populated the table with some test data using
INSERT INTO `<project>.<dataset>.<table>` (<list of fields, ending with repeated record name>)
VALUES
(
"string1", false, 200.0, "string2", 0.2, 2.345, false, "2020-01-02 12:34:56",
[
("repeated field str1", CAST(2.01 AS FLOAT64), CAST(201 as NUMERIC), false),
("repeated field str2", CAST(4.01 AS FLOAT64), CAST(702 as NUMERIC), true)
]
);
(etc) And the table is successfully populated, also I can query the data with
select * from <dataset>.<table>
and all fields, repeated and non-repeated, are returned. I can also successfully query the non-repeated fields from the table, as long as no repeated fields are specified in the query. However when I want to include specific repeated fields in the query (and I'm following the guide at https://cloud.google.com/bigquery/docs/legacy-nested-repeated) for example
SELECT normalfield1, normalfield2, normalfield3,
repeatedData.field1, repeatedData.field2, repeatedData.field3
FROM `profile_dataset.profile_betdatamultiples`;
I get error
Cannot access field <field name> on a value with type ARRAY<STRUCT<fieldname1 STRING, fieldname2 FLOAT64, fieldname3 NUMERIC, ...>> at [8:14]"
(annoyingly GCP truncates the error message so I can't see all of it)
Are there any suggestions for how to proceed here?
Thanks!