Reference documentation and code samples for the Google BigQuery Storage V1 Client class AppendRowsRequest.
Request message for AppendRows
.
Because AppendRows is a bidirectional streaming RPC, certain parts of the
AppendRowsRequest need only be specified for the first request before
switching table destinations. You can also switch table destinations within
the same connection for the default stream.
The size of a single AppendRowsRequest must be less than 10 MB in size.
Requests larger than this return an error, typically INVALID_ARGUMENT
.
Generated from protobuf message google.cloud.bigquery.storage.v1.AppendRowsRequest
Namespace
Google \ Cloud \ BigQuery \ Storage \ V1Methods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
data |
array
Optional. Data for populating the Message object. |
↳ write_stream |
string
Required. The write_stream identifies the append operation. It must be provided in the following scenarios: * In the first request to an AppendRows connection. * In all subsequent requests to an AppendRows connection, if you use the same connection to write to multiple tables or change the input schema for default streams. For explicitly created write streams, the format is: * |
↳ offset |
Google\Protobuf\Int64Value
If present, the write is only performed if the next append offset is same as the provided value. If not present, the write is performed at the current end of stream. Specifying a value for this field is not allowed when calling AppendRows for the '_default' stream. |
↳ proto_rows |
Google\Cloud\BigQuery\Storage\V1\AppendRowsRequest\ProtoData
Rows in proto format. |
↳ trace_id |
string
Id set by client to annotate its identity. Only initial request setting is respected. |
↳ missing_value_interpretations |
array|Google\Protobuf\Internal\MapField
A map to indicate how to interpret missing value for some fields. Missing values are fields present in user schema but missing in rows. The key is the field name. The value is the interpretation of missing values for the field. For example, a map {'foo': NULL_VALUE, 'bar': DEFAULT_VALUE} means all missing values in field foo are interpreted as NULL, all missing values in field bar are interpreted as the default value of field bar in table schema. If a field is not in this map and has missing values, the missing values in this field are interpreted as NULL. This field only applies to the current request, it won't affect other requests on the connection. Currently, field name can only be top-level column name, can't be a struct field path like 'foo.bar'. |
↳ default_missing_value_interpretation |
int
Optional. Default missing value interpretation for all columns in the table. When a value is specified on an |
getWriteStream
Required. The write_stream identifies the append operation. It must be provided in the following scenarios:
In the first request to an AppendRows connection.
In all subsequent requests to an AppendRows connection, if you use the same connection to write to multiple tables or change the input schema for default streams. For explicitly created write streams, the format is:
projects/{project}/datasets/{dataset}/tables/{table}/streams/{id}
For the special default stream, the format is:projects/{project}/datasets/{dataset}/tables/{table}/streams/_default
. An example of a possible sequence of requests with write_stream fields within a single connection:- r1: {write_stream: stream_name_1}
- r2: {write_stream: /omit/}
- r3: {write_stream: /omit/}
- r4: {write_stream: stream_name_2}
- r5: {write_stream: stream_name_2} The destination changed in request_4, so the write_stream field must be populated in all subsequent requests in this stream.
Returns | |
---|---|
Type | Description |
string |
setWriteStream
Required. The write_stream identifies the append operation. It must be provided in the following scenarios:
In the first request to an AppendRows connection.
In all subsequent requests to an AppendRows connection, if you use the same connection to write to multiple tables or change the input schema for default streams. For explicitly created write streams, the format is:
projects/{project}/datasets/{dataset}/tables/{table}/streams/{id}
For the special default stream, the format is:projects/{project}/datasets/{dataset}/tables/{table}/streams/_default
. An example of a possible sequence of requests with write_stream fields within a single connection:- r1: {write_stream: stream_name_1}
- r2: {write_stream: /omit/}
- r3: {write_stream: /omit/}
- r4: {write_stream: stream_name_2}
- r5: {write_stream: stream_name_2} The destination changed in request_4, so the write_stream field must be populated in all subsequent requests in this stream.
Parameter | |
---|---|
Name | Description |
var |
string
|
Returns | |
---|---|
Type | Description |
$this |
getOffset
If present, the write is only performed if the next append offset is same as the provided value. If not present, the write is performed at the current end of stream. Specifying a value for this field is not allowed when calling AppendRows for the '_default' stream.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Int64Value|null |
hasOffset
clearOffset
getOffsetUnwrapped
Returns the unboxed value from getOffset()
If present, the write is only performed if the next append offset is same as the provided value. If not present, the write is performed at the current end of stream. Specifying a value for this field is not allowed when calling AppendRows for the '_default' stream.
Returns | |
---|---|
Type | Description |
int|string|null |
setOffset
If present, the write is only performed if the next append offset is same as the provided value. If not present, the write is performed at the current end of stream. Specifying a value for this field is not allowed when calling AppendRows for the '_default' stream.
Parameter | |
---|---|
Name | Description |
var |
Google\Protobuf\Int64Value
|
Returns | |
---|---|
Type | Description |
$this |
setOffsetUnwrapped
Sets the field by wrapping a primitive type in a Google\Protobuf\Int64Value object.
If present, the write is only performed if the next append offset is same as the provided value. If not present, the write is performed at the current end of stream. Specifying a value for this field is not allowed when calling AppendRows for the '_default' stream.
Parameter | |
---|---|
Name | Description |
var |
int|string|null
|
Returns | |
---|---|
Type | Description |
$this |
getProtoRows
Rows in proto format.
Returns | |
---|---|
Type | Description |
Google\Cloud\BigQuery\Storage\V1\AppendRowsRequest\ProtoData|null |
hasProtoRows
setProtoRows
Rows in proto format.
Parameter | |
---|---|
Name | Description |
var |
Google\Cloud\BigQuery\Storage\V1\AppendRowsRequest\ProtoData
|
Returns | |
---|---|
Type | Description |
$this |
getTraceId
Id set by client to annotate its identity. Only initial request setting is respected.
Returns | |
---|---|
Type | Description |
string |
setTraceId
Id set by client to annotate its identity. Only initial request setting is respected.
Parameter | |
---|---|
Name | Description |
var |
string
|
Returns | |
---|---|
Type | Description |
$this |
getMissingValueInterpretations
A map to indicate how to interpret missing value for some fields. Missing values are fields present in user schema but missing in rows. The key is the field name. The value is the interpretation of missing values for the field.
For example, a map {'foo': NULL_VALUE, 'bar': DEFAULT_VALUE} means all missing values in field foo are interpreted as NULL, all missing values in field bar are interpreted as the default value of field bar in table schema. If a field is not in this map and has missing values, the missing values in this field are interpreted as NULL. This field only applies to the current request, it won't affect other requests on the connection. Currently, field name can only be top-level column name, can't be a struct field path like 'foo.bar'.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\MapField |
setMissingValueInterpretations
A map to indicate how to interpret missing value for some fields. Missing values are fields present in user schema but missing in rows. The key is the field name. The value is the interpretation of missing values for the field.
For example, a map {'foo': NULL_VALUE, 'bar': DEFAULT_VALUE} means all missing values in field foo are interpreted as NULL, all missing values in field bar are interpreted as the default value of field bar in table schema. If a field is not in this map and has missing values, the missing values in this field are interpreted as NULL. This field only applies to the current request, it won't affect other requests on the connection. Currently, field name can only be top-level column name, can't be a struct field path like 'foo.bar'.
Parameter | |
---|---|
Name | Description |
var |
array|Google\Protobuf\Internal\MapField
|
Returns | |
---|---|
Type | Description |
$this |
getDefaultMissingValueInterpretation
Optional. Default missing value interpretation for all columns in the
table. When a value is specified on an AppendRowsRequest
, it is applied
to all requests on the connection from that point forward, until a
subsequent AppendRowsRequest
sets it to a different value.
missing_value_interpretation
can override
default_missing_value_interpretation
. For example, if you want to write
NULL
instead of using default values for some columns, you can set
default_missing_value_interpretation
to DEFAULT_VALUE
and at the same
time, set missing_value_interpretations
to NULL_VALUE
on those columns.
Returns | |
---|---|
Type | Description |
int |
setDefaultMissingValueInterpretation
Optional. Default missing value interpretation for all columns in the
table. When a value is specified on an AppendRowsRequest
, it is applied
to all requests on the connection from that point forward, until a
subsequent AppendRowsRequest
sets it to a different value.
missing_value_interpretation
can override
default_missing_value_interpretation
. For example, if you want to write
NULL
instead of using default values for some columns, you can set
default_missing_value_interpretation
to DEFAULT_VALUE
and at the same
time, set missing_value_interpretations
to NULL_VALUE
on those columns.
Parameter | |
---|---|
Name | Description |
var |
int
|
Returns | |
---|---|
Type | Description |
$this |
getRows
Returns | |
---|---|
Type | Description |
string |
static::build
Parameter | |
---|---|
Name | Description |
writeStream |
string
Required. The write_stream identifies the append operation. It must be provided in the following scenarios:
For explicitly created write streams, the format is:
For the special default stream, the format is:
An example of a possible sequence of requests with write_stream fields within a single connection:
The destination changed in request_4, so the write_stream field must be populated in all subsequent requests in this stream. Please see Google\Cloud\BigQuery\Storage\V1\BigQueryWriteClient::writeStreamName() for help formatting this field. |
Returns | |
---|---|
Type | Description |
Google\Cloud\BigQuery\Storage\V1\AppendRowsRequest |