BigQuery Storage API v1beta1 - Package cloud.google.com/go/bigquery/storage/apiv1beta1 (v1.72.0) Stay organized with collections Save and categorize content based on your preferences.
- 1.72.0 (latest)
- 1.71.0
- 1.70.0
- 1.69.0
- 1.68.0
- 1.67.0
- 1.66.2
- 1.65.0
- 1.64.0
- 1.63.1
- 1.62.0
- 1.61.0
- 1.60.0
- 1.59.1
- 1.58.0
- 1.57.1
- 1.54.0
- 1.53.0
- 1.52.0
- 1.51.2
- 1.50.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.36.0
- 1.35.0
- 1.34.1
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.2
- 1.29.0
- 1.28.0
- 1.27.0
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.1
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
Beta
This library is covered by thePre-GA Offerings Terms of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see thelaunch stage descriptions.
Note: To get more information about this package, such as access to older versions, viewthis package on pkg.go.dev.Package storage is an auto-generated package for theBigQuery Storage API.
NOTE:Thispackageisinbeta.Itisnotstable,andmaybesubjecttochanges.
General documentation
For information that is relevant for all client libraries please referencehttps://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on thispage includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/bigquery/storage/apiv1beta1@latestctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=storage.NewBigQueryStorageClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed.The methods of Client are safe for concurrent use by multiple goroutines.The returned client must be Closed when it is done being used.
Using the Client
The following is an example of making an API call with the newly created client, mentioned above.
req:=&storagepb.BatchCreateReadSessionStreamsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/bigquery/storage/apiv1beta1/storagepb#BatchCreateReadSessionStreamsRequest.}resp,err:=c.BatchCreateReadSessionStreams(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp
Use of Context
The ctx passed to NewBigQueryStorageClient is used for authentication requests andfor creating the underlying connection, but is not used for subsequent calls.Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Functions
func DefaultAuthScopes
funcDefaultAuthScopes()[]stringDefaultAuthScopes reports the default set of authentication scopes to use with this package.
BigQueryStorageCallOptions
typeBigQueryStorageCallOptionsstruct{CreateReadSession[]gax.CallOptionReadRows[]gax.CallOptionBatchCreateReadSessionStreams[]gax.CallOptionFinalizeStream[]gax.CallOptionSplitReadStream[]gax.CallOption}BigQueryStorageCallOptions contains the retry settings for each method of BigQueryStorageClient.
BigQueryStorageClient
typeBigQueryStorageClientstruct{// The call options for this service.CallOptions*BigQueryStorageCallOptions// contains filtered or unexported fields}BigQueryStorageClient is a client for interacting with BigQuery Storage API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
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 fulldeprecation cycle (https://cloud.google.com/products#product-launch-stages (athttps://cloud.google.com/products#product-launch-stages))before the service is turned down. However, new code should use the v1 APIgoing forward.
func NewBigQueryStorageClient
funcNewBigQueryStorageClient(ctxcontext.Context,opts...option.ClientOption)(*BigQueryStorageClient,error)NewBigQueryStorageClient creates a new big query storage client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
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 fulldeprecation cycle (https://cloud.google.com/products#product-launch-stages (athttps://cloud.google.com/products#product-launch-stages))before the service is turned down. However, new code should use the v1 APIgoing forward.
Example
packagemainimport("context"storage"cloud.google.com/go/bigquery/storage/apiv1beta1")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=storage.NewBigQueryStorageClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewBigQueryStorageRESTClient
funcNewBigQueryStorageRESTClient(ctxcontext.Context,opts...option.ClientOption)(*BigQueryStorageClient,error)NewBigQueryStorageRESTClient creates a new big query storage rest client.
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 fulldeprecation cycle (https://cloud.google.com/products#product-launch-stages (athttps://cloud.google.com/products#product-launch-stages))before the service is turned down. However, new code should use the v1 APIgoing forward.
Example
packagemainimport("context"storage"cloud.google.com/go/bigquery/storage/apiv1beta1")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=storage.NewBigQueryStorageRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*BigQueryStorageClient) BatchCreateReadSessionStreams
func(c*BigQueryStorageClient)BatchCreateReadSessionStreams(ctxcontext.Context,req*storagepb.BatchCreateReadSessionStreamsRequest,opts...gax.CallOption)(*storagepb.BatchCreateReadSessionStreamsResponse,error)BatchCreateReadSessionStreams creates additional streams for a ReadSession. This API can be used todynamically adjust the parallelism of a batch processing task upwards byadding additional workers.
Example
packagemainimport("context"storage"cloud.google.com/go/bigquery/storage/apiv1beta1"storagepb"cloud.google.com/go/bigquery/storage/apiv1beta1/storagepb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=storage.NewBigQueryStorageClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&storagepb.BatchCreateReadSessionStreamsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/bigquery/storage/apiv1beta1/storagepb#BatchCreateReadSessionStreamsRequest.}resp,err:=c.BatchCreateReadSessionStreams(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BigQueryStorageClient) Close
func(c*BigQueryStorageClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*BigQueryStorageClient) Connection (deprecated)
func(c*BigQueryStorageClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*BigQueryStorageClient) CreateReadSession
func(c*BigQueryStorageClient)CreateReadSession(ctxcontext.Context,req*storagepb.CreateReadSessionRequest,opts...gax.CallOption)(*storagepb.ReadSession,error)CreateReadSession creates a new read session. A read session divides the contents of aBigQuery table into one or more streams, which can then be used to readdata from the table. The read session also specifies properties of thedata to be read, such as a list of columns or a push-down filter describingthe rows to be returned.
A particular row can be read by at most one stream. When the caller hasreached the end of each stream in the session, then all the data in thetable has been read.
Read sessions automatically expire 6 hours after they are created and donot require manual clean-up by the caller.
Example
packagemainimport("context"storage"cloud.google.com/go/bigquery/storage/apiv1beta1"storagepb"cloud.google.com/go/bigquery/storage/apiv1beta1/storagepb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=storage.NewBigQueryStorageClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&storagepb.CreateReadSessionRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/bigquery/storage/apiv1beta1/storagepb#CreateReadSessionRequest.}resp,err:=c.CreateReadSession(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BigQueryStorageClient) FinalizeStream
func(c*BigQueryStorageClient)FinalizeStream(ctxcontext.Context,req*storagepb.FinalizeStreamRequest,opts...gax.CallOption)errorFinalizeStream causes a single stream in a ReadSession to gracefully stop. ThisAPI can be used to dynamically adjust the parallelism of a batch processingtask downwards without losing data.
This API does not delete the stream – it remains visible in theReadSession, and any data processed by the stream is not released to otherstreams. However, no additional data will be assigned to the stream oncethis call completes. Callers must continue reading data on the stream untilthe end of the stream is reached so that data which has already beenassigned to the stream will be processed.
This method will return an error if there are no other live streamsin the Session, or if SplitReadStream() has been called on the givenStream.
Example
packagemainimport("context"storage"cloud.google.com/go/bigquery/storage/apiv1beta1"storagepb"cloud.google.com/go/bigquery/storage/apiv1beta1/storagepb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=storage.NewBigQueryStorageClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&storagepb.FinalizeStreamRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/bigquery/storage/apiv1beta1/storagepb#FinalizeStreamRequest.}err=c.FinalizeStream(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*BigQueryStorageClient) ReadRows
func(c*BigQueryStorageClient)ReadRows(ctxcontext.Context,req*storagepb.ReadRowsRequest,opts...gax.CallOption)(storagepb.BigQueryStorage_ReadRowsClient,error)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 MiBper response; read requests which attempt to read individual rows largerthan this will fail.
Each request also returns a set of stream statistics reflecting theestimated total number of rows in the read stream. This number is computedbased on the total table size and the number of active streams in the readsession, and may change as other streams continue to read data.
func (*BigQueryStorageClient) SplitReadStream
func(c*BigQueryStorageClient)SplitReadStream(ctxcontext.Context,req*storagepb.SplitReadStreamRequest,opts...gax.CallOption)(*storagepb.SplitReadStreamResponse,error)SplitReadStream splits a given read stream into two Streams. These streams are referred toas the primary and the residual of the split. The original stream can stillbe read from in the same manner as before. Both of the returned streams canalso be read from, and the total rows return by both child streams will bethe same as the rows read from the original stream.
Moreover, the two child streams will be allocated back to back in theoriginal Stream. Concretely, it is guaranteed that for streams Original,Primary, and Residual, that Original[0-j] = Primary[0-j] andOriginal[j-n] = Residual[0-m] once the streams have been read tocompletion.
This method is guaranteed to be idempotent.
Example
packagemainimport("context"storage"cloud.google.com/go/bigquery/storage/apiv1beta1"storagepb"cloud.google.com/go/bigquery/storage/apiv1beta1/storagepb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=storage.NewBigQueryStorageClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&storagepb.SplitReadStreamRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/bigquery/storage/apiv1beta1/storagepb#SplitReadStreamRequest.}resp,err:=c.SplitReadStream(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-30 UTC.