Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BigQuery: Array specified for non-repeated field

I want to upload JSON data to a BigQuery table. The JSON structure is as follows:

{
    a: [1,2,3]
}

But I am getting this error: Array specified for non-repeated field a

like image 513
Shubham Chauhan Avatar asked Feb 03 '26 19:02

Shubham Chauhan


1 Answers

Here is a DDL for table that accepts that JSON structure:

create table `sample_table` (
    a ARRAY<INT64>
);

Note that:

  • Each one of those JSON represents a row in the table.
  • The above DDL will produce a table with a single column of Field name a, Type INTEGER and Mode REPEATED.

If you are using the API, the JSON representation of the table's schema may look like this:

{
    "fields":[
        {
            "name":"a",
            "type":"INTEGER",
            "mode":"REPEATED",
            <...>
        }
    ]
}
like image 113
Ricardo Avatar answered Feb 05 '26 10:02

Ricardo