Class AppendRowsStream (2.24.0)

AppendRowsStream(
    client: google.cloud.bigquery_storage_v1beta2.services.big_query_write.client.BigQueryWriteClient,
    initial_request_template: google.cloud.bigquery_storage_v1beta2.types.storage.AppendRowsRequest,
    metadata: typing.Sequence[typing.Tuple[str, str]] = (),
)

A manager object which can append rows to a stream.

Properties

is_active

bool: True if this manager is actively streaming.

Note that False does not indicate this is complete shut down, just that it stopped getting new messages.

Methods

AppendRowsStream

AppendRowsStream(
    client: google.cloud.bigquery_storage_v1beta2.services.big_query_write.client.BigQueryWriteClient,
    initial_request_template: google.cloud.bigquery_storage_v1beta2.types.storage.AppendRowsRequest,
    metadata: typing.Sequence[typing.Tuple[str, str]] = (),
)

Construct a stream manager.

Parameters
Name Description
client BigQueryWriteClient

Client responsible for making requests.

initial_request_template AppendRowsRequest

Data to include in the first request sent to the stream. This must contain write_stream and writer_schema.

metadata typing.Sequence[typing.Tuple[str, str]]

Extra headers to include when sending the streaming request.

add_close_callback

add_close_callback(callback: typing.Callable)

Schedules a callable when the manager closes.

Parameter
Name Description
callback Callable

The method to call.

close

close(reason: typing.Optional[Exception] = None)

Stop consuming messages and shutdown all helper threads.

This method is idempotent. Additional calls will have no effect.

Parameter
Name Description
reason typing.Optional[Exception]

The reason to close this. If None, this is considered an "intentional" shutdown. This is passed to the callbacks specified via add_close_callback.

send

send(
    request: google.cloud.bigquery_storage_v1beta2.types.storage.AppendRowsRequest,
) -> google.cloud.bigquery_storage_v1beta2.writer.AppendRowsFuture

Send an append rows request to the open stream.

Parameter
Name Description
request AppendRowsRequest

The request to add to the stream.