BatchSnapshot(
database,
read_timestamp=None,
exact_staleness=None,
session_id=None,
transaction_id=None,
client_context=None,
)Wrapper for generating and processing read / query batches.
Parameters |
|
|---|---|
| Name | Description |
database |
Database
database to use |
read_timestamp |
Execute all reads at the given timestamp. |
exact_staleness |
Execute all reads at a timestamp that is |
Methods
__enter__
__enter__()Begin with block.
__exit__
__exit__(exc_type, exc_val, exc_tb)End with block.
close
close()Clean up underlying session.
execute_sql
execute_sql(*args, **kw)Convenience method: perform query operation via snapshot.
See execute_sql.
from_dict
from_dict(database, mapping)Reconstruct an instance from a mapping.
| Parameters | |
|---|---|
| Name | Description |
database |
Database
database to use |
mapping |
mapping
serialized state of the instance |
generate_query_batches
generate_query_batches(
sql,
params=None,
param_types=None,
partition_size_bytes=None,
max_partitions=None,
query_options=None,
data_boost_enabled=False,
directed_read_options=None,
*,
retry=_MethodDefault._DEFAULT_VALUE,
timeout=_MethodDefault._DEFAULT_VALUE
)Start a partitioned query operation.
generate_read_batches
generate_read_batches(
table,
columns,
keyset,
index="",
partition_size_bytes=None,
max_partitions=None,
data_boost_enabled=False,
directed_read_options=None,
*,
retry=_MethodDefault._DEFAULT_VALUE,
timeout=_MethodDefault._DEFAULT_VALUE
)Start a partitioned batch read operation.
process
process(batch)Process a single, partitioned query or read.
process_query_batch
process_query_batch(
batch,
*,
lazy_decode: bool = False,
retry=_MethodDefault._DEFAULT_VALUE,
timeout=_MethodDefault._DEFAULT_VALUE
)Process a single, partitioned query.
process_read_batch
process_read_batch(
batch,
*,
retry=_MethodDefault._DEFAULT_VALUE,
timeout=_MethodDefault._DEFAULT_VALUE,
lazy_decode=False
)Process a single, partitioned read.
read
read(*args, **kw)Convenience method: perform read operation via snapshot.
See read.
run_partitioned_query
run_partitioned_query(
sql,
params=None,
param_types=None,
partition_size_bytes=None,
max_partitions=None,
query_options=None,
data_boost_enabled=False,
lazy_decode=False,
)Start a partitioned query operation to get list of partitions and then executes each partition on a separate thread
to_dict
to_dict()Return state as a dictionary.
Result can be used to serialize the instance and reconstitute
it later using from_dict.