public static final class InsertAllRequest.Builder extends Object
Modifier and Type | Method and Description |
---|---|
InsertAllRequest.Builder |
addRow(InsertAllRequest.RowToInsert rowToInsert)
Adds a row to be inserted.
|
InsertAllRequest.Builder |
addRow(Map<String,?> content)
Adds a row to be inserted without an associated id.
|
InsertAllRequest.Builder |
addRow(String id,
Map<String,?> content)
Adds a row to be inserted with associated id.
|
InsertAllRequest |
build()
Creates an
InsertAllRequest object. |
InsertAllRequest.Builder |
setIgnoreUnknownValues(boolean ignoreUnknownValues)
Sets whether to accept rows that contain values that do not match the schema.
|
InsertAllRequest.Builder |
setRows(Iterable<InsertAllRequest.RowToInsert> rows)
Sets the rows to insert as a list of
InsertAllRequest.RowToInsert objects. |
InsertAllRequest.Builder |
setSkipInvalidRows(boolean skipInvalidRows)
Sets whether to insert all valid rows of a request, even if invalid rows exist.
|
InsertAllRequest.Builder |
setTable(TableId table)
Sets the destination table for rows insert request.
|
InsertAllRequest.Builder |
setTemplateSuffix(String templateSuffix)
If specified, the destination table is treated as a base template.
|
public InsertAllRequest.Builder setTable(TableId table)
public InsertAllRequest.Builder setRows(Iterable<InsertAllRequest.RowToInsert> rows)
InsertAllRequest.RowToInsert
objects.public InsertAllRequest.Builder addRow(InsertAllRequest.RowToInsert rowToInsert)
public InsertAllRequest.Builder addRow(String id, Map<String,?> content)
To ensure proper serialization of numeric data, supply values using a string-typed
representation. Additionally, data for fields of LegacySQLTypeName.BYTES
must be
provided as a base64 encoded string.
Example usage of adding a row with associated id:
InsertAllRequest.Builder builder = InsertAllRequest.builder(tableId);
List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
Map<String, Object> recordContent = new HashMap<String, Object>();
recordContent.put("subfieldName1", "value");
recordContent.put("subfieldName2", repeatedFieldValue);
Map<String, Object> rowContent = new HashMap<String, Object>();
rowContent.put("booleanFieldName", true);
rowContent.put("bytesFieldName", "DQ4KDQ==");
rowContent.put("recordFieldName", recordContent);
rowContent.put("numericFieldName", "1298930929292.129593272");
builder.addRow("rowId", rowContent);
public InsertAllRequest.Builder addRow(Map<String,?> content)
To ensure proper serialization of numeric data, it is recommended to supply values using a
string-typed representation. Additionally, data for fields of type LegacySQLTypeName.BYTES
must be provided as a base64 encoded string.
Example usage of adding a row without an associated id:
InsertAllRequest.Builder builder = InsertAllRequest.builder(tableId);
List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
Map<String, Object> recordContent = new HashMap<String, Object>();
recordContent.put("subfieldName1", "value");
recordContent.put("subfieldName2", repeatedFieldValue);
Map<String, Object> rowContent = new HashMap<String, Object>();
rowContent.put("booleanFieldName", true);
rowContent.put("bytesFieldName", "DQ4KDQ==");
rowContent.put("recordFieldName", recordContent);
rowContent.put("numericFieldName", "1298930929292.129593272");
builder.addRow(rowContent);
public InsertAllRequest.Builder setSkipInvalidRows(boolean skipInvalidRows)
public InsertAllRequest.Builder setIgnoreUnknownValues(boolean ignoreUnknownValues)
public InsertAllRequest.Builder setTemplateSuffix(String templateSuffix)
BigQuery.insertAll(InsertAllRequest)
is called use:
String suffixTableId = ...;
TableInfo suffixTable = bigquery.getTable(DATASET, suffixTableId);
while (suffixTable == null) {
Thread.sleep(1000L);
suffixTable = bigquery.getTable(DATASET, suffixTableId);
}
public InsertAllRequest build()
InsertAllRequest
object.Copyright © 2021 Google LLC. All rights reserved.