Package com.google.cloud.bigquery
Class InsertAllRequest
- java.lang.Object
-
- com.google.cloud.bigquery.InsertAllRequest
-
- All Implemented Interfaces:
Serializable
public final class InsertAllRequest extends Object implements Serializable
Google Cloud BigQuery insert all request. This class can be used to stream data into BigQuery one record at a time without needing to run a load job. This approach enables querying data without the delay of running a load job. There are several important trade-offs to consider before choosing an approach.- See Also:
- Streaming Data into BigQuery, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInsertAllRequest.Builderstatic classInsertAllRequest.RowToInsertA Google Big Query row to be inserted into a table.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)List<InsertAllRequest.RowToInsert>getRows()Returns the rows to be inserted.TableIdgetTable()Returns the destination table for rows insert request.StringgetTemplateSuffix()If specified, the destination table is treated as a base template.inthashCode()BooleanignoreUnknownValues()Returns whether to accept rows that contain values that do not match the schema.static InsertAllRequest.BuildernewBuilder(TableId table)Returns a builder for anInsertAllRequestobject given the destination table.static InsertAllRequest.BuildernewBuilder(TableId table, InsertAllRequest.RowToInsert... rows)Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.static InsertAllRequest.BuildernewBuilder(TableId table, Iterable<InsertAllRequest.RowToInsert> rows)Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.static InsertAllRequest.BuildernewBuilder(TableInfo tableInfo, InsertAllRequest.RowToInsert... rows)Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.static InsertAllRequest.BuildernewBuilder(TableInfo tableInfo, Iterable<InsertAllRequest.RowToInsert> rows)Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.static InsertAllRequest.BuildernewBuilder(String datasetId, String tableId)Returns a builder for anInsertAllRequestobject given the destination table.static InsertAllRequest.BuildernewBuilder(String datasetId, String tableId, InsertAllRequest.RowToInsert... rows)Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.static InsertAllRequest.BuildernewBuilder(String datasetId, String tableId, Iterable<InsertAllRequest.RowToInsert> rows)Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.static InsertAllRequestof(TableId tableId, InsertAllRequest.RowToInsert... rows)Returns aInsertAllRequestobject given the destination table and the rows to insert.static InsertAllRequestof(TableId tableId, Iterable<InsertAllRequest.RowToInsert> rows)Returns aInsertAllRequestobject given the destination table and the rows to insert.static InsertAllRequestof(TableInfo tableInfo, InsertAllRequest.RowToInsert... rows)Returns aInsertAllRequestobject given the destination table and the rows to insert.static InsertAllRequestof(TableInfo tableInfo, Iterable<InsertAllRequest.RowToInsert> rows)Returns aInsertAllRequestobject given the destination table and the rows to insert.static InsertAllRequestof(String datasetId, String tableId, InsertAllRequest.RowToInsert... rows)Returns aInsertAllRequestobject given the destination table and the rows to insert.static InsertAllRequestof(String datasetId, String tableId, Iterable<InsertAllRequest.RowToInsert> rows)Returns aInsertAllRequestobject given the destination table and the rows to insert.BooleanskipInvalidRows()Returns whether to insert all valid rows of a request, even if invalid rows exist.StringtoString()
-
-
-
Method Detail
-
getTable
public TableId getTable()
Returns the destination table for rows insert request.
-
getRows
public List<InsertAllRequest.RowToInsert> getRows()
Returns the rows to be inserted.
-
ignoreUnknownValues
public Boolean ignoreUnknownValues()
Returns whether to accept rows that contain values that do not match the schema. The unknown values are ignored. If not set, rows with unknown values are considered to be invalid.
-
skipInvalidRows
public Boolean skipInvalidRows()
Returns whether to insert all valid rows of a request, even if invalid rows exist. If not set the entire insert request will fail if it contains an invalid row.
-
getTemplateSuffix
public String getTemplateSuffix()
If specified, the destination table is treated as a base template. Rows are inserted into an instance table named "{destination}{templateSuffix}". BigQuery will manage the creation of the instance table, using the schema of the base template table. Table creation might take some time. To obtain table's information afterBigQuery.insertAll(InsertAllRequest)is called use:String suffixTableId = ...; TableInfo suffixTable = bigquery.getTable(DATASET, suffixTableId); while (suffixTable == null) { Thread.sleep(1000L); suffixTable = bigquery.getTable(DATASET, suffixTableId); }- See Also:
- Template Tables
-
newBuilder
public static InsertAllRequest.Builder newBuilder(TableId table)
Returns a builder for anInsertAllRequestobject given the destination table.
-
newBuilder
public static InsertAllRequest.Builder newBuilder(TableId table, Iterable<InsertAllRequest.RowToInsert> rows)
Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.
-
newBuilder
public static InsertAllRequest.Builder newBuilder(TableId table, InsertAllRequest.RowToInsert... rows)
Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.
-
newBuilder
public static InsertAllRequest.Builder newBuilder(String datasetId, String tableId)
Returns a builder for anInsertAllRequestobject given the destination table.
-
newBuilder
public static InsertAllRequest.Builder newBuilder(String datasetId, String tableId, Iterable<InsertAllRequest.RowToInsert> rows)
Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.
-
newBuilder
public static InsertAllRequest.Builder newBuilder(String datasetId, String tableId, InsertAllRequest.RowToInsert... rows)
Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.
-
newBuilder
public static InsertAllRequest.Builder newBuilder(TableInfo tableInfo, Iterable<InsertAllRequest.RowToInsert> rows)
Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.
-
newBuilder
public static InsertAllRequest.Builder newBuilder(TableInfo tableInfo, InsertAllRequest.RowToInsert... rows)
Returns a builder for anInsertAllRequestobject given the destination table and the rows to insert.
-
of
public static InsertAllRequest of(TableId tableId, Iterable<InsertAllRequest.RowToInsert> rows)
Returns aInsertAllRequestobject given the destination table and the rows to insert.
-
of
public static InsertAllRequest of(TableId tableId, InsertAllRequest.RowToInsert... rows)
Returns aInsertAllRequestobject given the destination table and the rows to insert.
-
of
public static InsertAllRequest of(String datasetId, String tableId, Iterable<InsertAllRequest.RowToInsert> rows)
Returns aInsertAllRequestobject given the destination table and the rows to insert.
-
of
public static InsertAllRequest of(String datasetId, String tableId, InsertAllRequest.RowToInsert... rows)
Returns aInsertAllRequestobject given the destination table and the rows to insert.
-
of
public static InsertAllRequest of(TableInfo tableInfo, Iterable<InsertAllRequest.RowToInsert> rows)
Returns aInsertAllRequestobject given the destination table and the rows to insert.
-
of
public static InsertAllRequest of(TableInfo tableInfo, InsertAllRequest.RowToInsert... rows)
Returns aInsertAllRequestobject given the destination table and the rows to insert.
-
-