I have a C# code which inserts a row into BigQuery. But the table in BigQuery has a record field. How should I insert the data into that table?
BigQuery Table:
column1 | column2 | column3.a | column3.b | column4
*column3 is a RECORD having multiple rows of "a" and "b"
This is what I have got so far in my C# code:
BigQueryClient BQclient = BigQueryClient.Create(project_id, credentials);
var table = BQclient.GetDataset("dataset").GetTable("table");
List < BigQueryInsertRow > rows = new List < BigQueryInsertRow >();
try {
for (int i=0; i < data.Count; i++ ) {
BigQueryInsertRow insertRow = new BigQueryInsertRow();
insertRow.Add("column1", data[i].column1);
insertRow.Add("column2", data[i].column2);
↓↓↓ this is where I am having a hard time ↓↓↓
for (int j=0; j < data[i].column3.Count; j++ ) {
insertRow.Add("colum3.a", data[i].column3[j].a);
insertRow.Add("colum3.b", data[i].column3[j].b);
}
↑↑↑ this is where I am having a hard time ↑↑↑
insertRow.Add("column4"), data[i].column4);
rows.Add(insertRow);
}
table.InsertRows(rows);
}
catch (Exception e) {
throw e;
}
table
? Is it a DataTable? 2) Can we see the definition ofBigQueryInsertRow
? – Casey CrookstoninsertRow.Add("column3", data[i].column3)
? – khan