Index
BigQueryStorage
(interface)ArrowRecordBatch
(message)ArrowSchema
(message)AvroRows
(message)AvroSchema
(message)BatchCreateReadSessionStreamsRequest
(message)BatchCreateReadSessionStreamsResponse
(message)CreateReadSessionRequest
(message)DataFormat
(enum)FinalizeStreamRequest
(message)Progress
(message)ReadRowsRequest
(message)ReadRowsResponse
(message)ReadSession
(message)ShardingStrategy
(enum)SplitReadStreamRequest
(message)SplitReadStreamResponse
(message)Stream
(message)StreamPosition
(message)StreamStatus
(message)TableModifiers
(message)TableReadOptions
(message)TableReference
(message)ThrottleStatus
(message)
BigQueryStorage
BigQuery storage API.
The BigQuery storage API can be used to read data stored in BigQuery.
The v1beta1 API is not yet officially deprecated, and will go through a full deprecation cycle (https://cloud.google.com/products#product-launch-stages) before the service is turned down. However, new code should use the v1 API going forward.
BatchCreateReadSessionStreams |
---|
Creates additional streams for a ReadSession. This API can be used to dynamically adjust the parallelism of a batch processing task upwards by adding additional workers. |
CreateReadSession |
---|
Creates a new read session. A read session divides the contents of a BigQuery table into one or more streams, which can then be used to read data from the table. The read session also specifies properties of the data to be read, such as a list of columns or a push-down filter describing the rows to be returned. A particular row can be read by at most one stream. When the caller has reached the end of each stream in the session, then all the data in the table has been read. Read sessions automatically expire 6 hours after they are created and do not require manual clean-up by the caller. |
FinalizeStream |
---|
Causes a single stream in a ReadSession to gracefully stop. This API can be used to dynamically adjust the parallelism of a batch processing task downwards without losing data. This API does not delete the stream -- it remains visible in the ReadSession, and any data processed by the stream is not released to other streams. However, no additional data will be assigned to the stream once this call completes. Callers must continue reading data on the stream until the end of the stream is reached so that data which has already been assigned to the stream will be processed. This method will return an error if there are no other live streams in the Session, or if SplitReadStream() has been called on the given Stream. |
ReadRows |
---|
Reads rows from the table in the format prescribed by the read session. Each response contains one or more table rows, up to a maximum of 10 MiB per response; read requests which attempt to read individual rows larger than this will fail. Each request also returns a set of stream statistics reflecting the estimated total number of rows in the read stream. This number is computed based on the total table size and the number of active streams in the read session, and may change as other streams continue to read data. |
SplitReadStream |
---|
Splits a given read stream into two Streams. These streams are referred to as the primary and the residual of the split. The original stream can still be read from in the same manner as before. Both of the returned streams can also be read from, and the total rows return by both child streams will be the same as the rows read from the original stream. Moreover, the two child streams will be allocated back to back in the original Stream. Concretely, it is guaranteed that for streams Original, Primary, and Residual, that Original[0-j] = Primary[0-j] and Original[j-n] = Residual[0-m] once the streams have been read to completion. This method is guaranteed to be idempotent. |
ArrowRecordBatch
Arrow RecordBatch.
Fields | |
---|---|
serialized_ |
IPC serialized Arrow RecordBatch. |
row_ |
The count of rows in the returning block. |
ArrowSchema
Arrow schema.
Fields | |
---|---|
serialized_ |
IPC serialized Arrow schema. |
AvroRows
Avro rows.
Fields | |
---|---|
serialized_ |
Binary serialized rows in a block. |
row_ |
The count of rows in the returning block. |
AvroSchema
Avro schema.
Fields | |
---|---|
schema |
Json serialized schema, as described at https://avro.apache.org/docs/1.8.1/spec.html |
BatchCreateReadSessionStreamsRequest
Information needed to request additional streams for an established read session.
Fields | |
---|---|
session |
Required. Must be a non-expired session obtained from a call to CreateReadSession. Only the name field needs to be set. |
requested_ |
Required. Number of new streams requested. Must be positive. Number of added streams may be less than this, see CreateReadSessionRequest for more information. |
BatchCreateReadSessionStreamsResponse
The response from BatchCreateReadSessionStreams
returns the stream identifiers for the newly created streams.
Fields | |
---|---|
streams[] |
Newly added streams. |
CreateReadSessionRequest
Creates a new read session, which may include additional options such as requested parallelism, projection filters and constraints.
Fields | |
---|---|
table_ |
Required. Reference to the table to read. Authorization requires the following IAM permission on the specified resource
|
parent |
Required. String of the form Authorization requires the following IAM permission on the specified resource
|
table_ |
Any modifiers to the Table (e.g. snapshot timestamp). |
requested_ |
Initial number of streams. If unset or 0, we will provide a value of streams so as to produce reasonable throughput. Must be non-negative. The number of streams may be lower than the requested number, depending on the amount parallelism that is reasonable for the table and the maximum amount of parallelism allowed by the system. Streams must be read starting from offset 0. |
read_ |
Read options for this session (e.g. column selection, filters). |
format |
Data output format. Currently default to Avro. DATA_FORMAT_UNSPECIFIED not supported. |
sharding_ |
The strategy to use for distributing data among multiple streams. Currently defaults to liquid sharding. |
DataFormat
Data format for input or output data.
Enums | |
---|---|
DATA_FORMAT_UNSPECIFIED |
Data format is unspecified. |
AVRO |
Avro is a standard open source row based file format. See https://avro.apache.org/ for more details. |
ARROW |
Arrow is a standard open source column-based message format. See https://arrow.apache.org/ for more details. |
FinalizeStreamRequest
Request information for invoking FinalizeStream
.
Fields | |
---|---|
stream |
Required. Stream to finalize. |
Progress
Fields | |
---|---|
at_ |
The fraction of rows assigned to the stream that have been processed by the server so far, not including the rows in the current response message. This value, along with Note that if a filter is provided, the |
at_ |
Similar to |
ReadRowsRequest
Requesting row data via ReadRows
must provide Stream position information.
Fields | |
---|---|
read_ |
Required. Identifier of the position in the stream to start reading from. The offset requested must be less than the last row read from ReadRows. Requesting a larger offset is undefined. |
ReadRowsResponse
Response from calling ReadRows
may include row data, progress and throttling information.
Fields | |
---|---|
row_ |
Number of serialized rows in the rows block. This value is recorded here, in addition to the row_count values in the output-specific messages in |
status |
Estimated stream statistics. |
throttle_ |
Throttling status. If unset, the latest response still describes the current throttling status. |
Union field rows . Row data is returned in format specified during session creation. rows can be only one of the following: |
|
avro_ |
Serialized row data in AVRO format. |
arrow_ |
Serialized row data in Arrow RecordBatch format. |
Union field schema . The schema for the read. If read_options.selected_fields is set, the schema may be different from the table schema as it will only contain the selected fields. This schema is equivalent to the one returned by CreateSession. This field is only populated in the first ReadRowsResponse RPC. schema can be only one of the following: |
|
avro_ |
Output only. Avro schema. |
arrow_ |
Output only. Arrow schema. |
ReadSession
Information returned from a CreateReadSession
request.
Fields | |
---|---|
name |
Unique identifier for the session, in the form |
expire_ |
Time at which the session becomes invalid. After this time, subsequent requests to read this Session will return errors. |
streams[] |
Streams associated with this session. |
table_ |
Table that this ReadSession is reading from. |
table_ |
Any modifiers which are applied when reading from the specified table. |
sharding_ |
The strategy to use for distributing data among the streams. |
Union field schema . The schema for the read. If read_options.selected_fields is set, the schema may be different from the table schema as it will only contain the selected fields. schema can be only one of the following: |
|
avro_ |
Avro schema. |
arrow_ |
Arrow schema. |
ShardingStrategy
Strategy for distributing data among multiple streams in a read session.
Enums | |
---|---|
SHARDING_STRATEGY_UNSPECIFIED |
Same as LIQUID. |
LIQUID |
Assigns data to each stream based on the client's read rate. The faster the client reads from a stream, the more data is assigned to the stream. In this strategy, it's possible to read all data from a single stream even if there are other streams present. |
BALANCED |
Assigns data to each stream such that roughly the same number of rows can be read from each stream. Because the server-side unit for assigning data is collections of rows, the API does not guarantee that each stream will return the same number or rows. Additionally, the limits are enforced based on the number of pre-filtering rows, so some filters can lead to lopsided assignments. |
SplitReadStreamRequest
Request information for SplitReadStream
.
Fields | |
---|---|
original_ |
Required. Stream to split. |
fraction |
A value in the range (0.0, 1.0) that specifies the fractional point at which the original stream should be split. The actual split point is evaluated on pre-filtered rows, so if a filter is provided, then there is no guarantee that the division of the rows between the new child streams will be proportional to this fractional value. Additionally, because the server-side unit for assigning data is collections of rows, this fraction will always map to to a data storage boundary on the server side. |
SplitReadStreamResponse
Response from SplitReadStream
.
Fields | |
---|---|
primary_ |
Primary stream, which contains the beginning portion of |original_stream|. An empty value indicates that the original stream can no longer be split. |
remainder_ |
Remainder stream, which contains the tail of |original_stream|. An empty value indicates that the original stream can no longer be split. |
Stream
Information about a single data stream within a read session.
Fields | |
---|---|
name |
Name of the stream, in the form |
StreamPosition
Expresses a point within a given stream using an offset position.
Fields | |
---|---|
stream |
Identifier for a given Stream. |
offset |
Position in the stream. |
StreamStatus
Progress information for a given Stream.
Fields | |
---|---|
estimated_ |
Number of estimated rows in the current stream. May change over time as different readers in the stream progress at rates which are relatively fast or slow. |
fraction_ |
A value in the range [0.0, 1.0] that represents the fraction of rows assigned to this stream that have been processed by the server. In the presence of read filters, the server may process more rows than it returns, so this value reflects progress through the pre-filtering rows. This value is only populated for sessions created through the BALANCED sharding strategy. |
progress |
Represents the progress of the current stream. |
is_ |
Whether this stream can be split. For sessions that use the LIQUID sharding strategy, this value is always false. For BALANCED sessions, this value is false when enough data have been read such that no more splits are possible at that point or beyond. For small tables or streams that are the result of a chain of splits, this value may never be true. |
TableModifiers
All fields in this message optional.
Fields | |
---|---|
snapshot_ |
The snapshot time of the table. If not set, interpreted as now. |
TableReadOptions
Options dictating how we read a table.
Fields | |
---|---|
selected_ |
Optional. The names of the fields in the table to be returned. If no field names are specified, then all fields in the table are returned. Nested fields -- the child elements of a STRUCT field -- can be selected individually using their fully-qualified names, and will be returned as record fields containing only the selected nested fields. If a STRUCT field is specified in the selected fields list, all of the child elements will be returned. As an example, consider a table with the following schema: { "name": "struct_field", "type": "RECORD", "mode": "NULLABLE", "fields": [ { "name": "string_field1", "type": "STRING", . "mode": "NULLABLE" }, { "name": "string_field2", "type": "STRING", "mode": "NULLABLE" } ] } Specifying "struct_field" in the selected fields list will result in a read session schema with the following logical structure: struct_field { string_field1 string_field2 } Specifying "struct_field.string_field1" in the selected fields list will result in a read session schema with the following logical structure: struct_field { string_field1 } The order of the fields in the read session schema is derived from the table schema and does not correspond to the order in which the fields are specified in this list. |
row_ |
Optional. SQL text filtering statement, similar to a WHERE clause in a SQL query. Aggregates are not supported. Examples: "int_field > 5" "date_field = CAST('2014-9-27' as DATE)" "nullable_field is not NULL" "st_equals(geo_field, st_geofromtext("POINT(2, 2)"))" "numeric_field BETWEEN 1.0 AND 5.0" Restricted to a maximum length for 1 MB. |
TableReference
Table reference that includes just the 3 strings needed to identify a table.
Fields | |
---|---|
project_ |
The assigned project ID of the project. |
dataset_ |
The ID of the dataset in the above project. |
table_ |
The ID of the table in the above dataset. |
ThrottleStatus
Information on if the current connection is being throttled.
Fields | |
---|---|
throttle_ |
How much this connection is being throttled. 0 is no throttling, 100 is completely throttled. |