As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Execute Query Iterator Async

class google.cloud.bigtable.data.execute_query.ExecuteQueryIteratorAsync(client: BigtableDataClientAsync, instance_id: str, app_profile_id: Optional[str], request_body: Dict[str, Any], attempt_timeout: float | None, operation_timeout: float, req_metadata: Sequence[Tuple[str, str]], retryable_excs: List[type[Exception]])[source]

Bases: object

ExecuteQueryIteratorAsync handles collecting streaming responses from the ExecuteQuery RPC and parsing them to QueryResultRows.

ExecuteQueryIteratorAsync implements Asynchronous Iterator interface and can be used with “async for” syntax. It is also a context manager.

It is not thread-safe. It should not be used by multiple asyncio Tasks.

Parameters
  • client – bigtable client

  • instance_id – id of the instance on which the query is executed

  • request_body – dict representing the body of the ExecuteQueryRequest

  • attempt_timeout – the time budget for the entire operation, in seconds. Failed requests will be retried within the budget. Defaults to 600 seconds.

  • operation_timeout – the time budget for an individual network request, in seconds. If it takes longer than this time to complete, the request will be cancelled with a DeadlineExceeded exception, and a retry will be attempted. Defaults to the 20 seconds. If None, defaults to operation_timeout.

  • req_metadata – metadata used while sending the gRPC request

  • retryable_excs – a list of errors that will be retried if encountered.

Raises

RuntimeError – if the instance is not created within an async event loop context.

property app_profile_id: Optional[str]

Returns the app_profile_id of the iterator.

async close() None[source]

Cancel all background tasks. Should be called all rows were processed.

property is_closed: bool

Returns True if the iterator is closed, False otherwise.

async metadata() Optional[google.cloud.bigtable.data.execute_query.metadata.Metadata][source]

Returns query metadata from the server or None if the iterator was explicitly closed.

property table_name: Optional[str]

Returns the table_name of the iterator.