Class reader.ReadClient (4.10.0)

BigQuery Read API Client. The Read API can be used to read data to BigQuery.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

For supplementary information about the Read API, see: https://cloud.google.com/bigquery/docs/read-api

reader

Package

@google-cloud/bigquery-storage

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Constructs a new instance of the ReadClient class

Parameter
Name Description
opts ClientOptions

Properties

getClient

getClient: () => BigQueryReadClient;

initialize

initialize: () => Promise<void>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

setClient

setClient: (client: BigQueryReadClient) => void;

Methods

close()

close(): void;
Returns
Type Description
void

createArrowTableReader(params)

createArrowTableReader(params: {
        table: TableReference;
    }): Promise<ArrowTableReader>;
Parameter
Name Description
params { table: TableReference; }
Returns
Type Description
Promise<ArrowTableReader>

createReadSession(request)

createReadSession(request: {
        parent: string;
        table: string;
        dataFormat: DataFormat;
        selectedFields?: string[];
    }): Promise<ReadSession>;

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.

Data is assigned 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-filtered rows, so some filters can lead to lopsided assignments.

Read sessions automatically expire 6 hours after they are created and do not require manual clean-up by the caller.

Parameter
Name Description
request { parent: string; table: string; dataFormat: DataFormat; selectedFields?: string[]; }

The request object that will be sent.

Returns
Type Description
Promise<ReadSession>

{Promise

createReadStream(request, options)

createReadStream(request: {
        streamName: string;
        session: ReadSession;
    }, options?: CallOptions): Promise<ReadStream>;

Creates a ReadStream to the given stream name and ReadSession.

Parameters
Name Description
request { streamName: string; session: ReadSession; }

The request object that will be sent.

options CallOptions
Returns
Type Description
Promise<ReadStream>

{Promise

createTableReader(params)

createTableReader(params: {
        table: TableReference;
    }): Promise<TableReader>;
Parameter
Name Description
params { table: TableReference; }
Returns
Type Description
Promise<TableReader>