use of com.google.cloud.bigquery.InsertAllResponse in project google-cloud-java by GoogleCloudPlatform.
the class TableSnippets method insert.
/**
* Example of inserting rows into the table.
*/
// [TARGET insert(Iterable)]
// [VARIABLE "rowId1"]
// [VARIABLE "rowId2"]
public InsertAllResponse insert(String rowId1, String rowId2) {
// [START insert]
List<RowToInsert> rows = new ArrayList<>();
Map<String, Object> row1 = new HashMap<>();
row1.put("stringField", "value1");
row1.put("booleanField", true);
Map<String, Object> row2 = new HashMap<>();
row2.put("stringField", "value2");
row2.put("booleanField", false);
rows.add(RowToInsert.of(rowId1, row1));
rows.add(RowToInsert.of(rowId2, row2));
InsertAllResponse response = table.insert(rows);
// [END insert]
return response;
}
Aggregations