When inserting rows where a field A is a repeated Record, if A.a is None, and A.b. is 1, the fields are collapsed. The value of A.b is inserted into A.a instead of leaving A.a as Null.
from google.cloud import bigquery as bq
# my_table schema
schema = [SchemaField("Key"), "INTERER",
SchemaField(
"A",
"RECORD",
mode="REPEATED",
fields=[
SchemaField("a", "STRING"),
SchemaField("b", "STRING")]
client = bq.Client()
tbl_ref = client.get_table(client.dataset('test-dataset').table('my_table'))
row = [{"Key":1, "A":{"a":None, "b":"not-null"}}]
client.insert_rows(row)
Result is a record in bigquery where key=1, A.a=’not-null’
New contributor
Kevin Gould is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.