Batch(session, client_context=None)Accumulate mutations for transmission during commit.
Methods
__enter__
__enter__()Begin with block.
__exit__
__exit__(exc_type, exc_val, exc_tb)End with block.
commit
commit(
return_commit_stats=False,
request_options=None,
max_commit_delay=None,
exclude_txn_from_change_streams=False,
isolation_level=IsolationLevel.ISOLATION_LEVEL_UNSPECIFIED,
read_lock_mode=ReadLockMode.READ_LOCK_MODE_UNSPECIFIED,
timeout_secs=30,
default_retry_delay=None,
)Commit mutations to the database.
| Parameters | |
|---|---|
| Name | Description |
return_commit_stats |
bool
If true, the response will return commit stats which can be accessed though commit_stats. |
request_options |
RequestOptions
(Optional) Common options for this request. If a dict is provided, it must be of the same form as the protobuf message RequestOptions. |
max_commit_delay |
(Optional) The amount of latency this request is willing to incur in order to improve throughput. |
exclude_txn_from_change_streams |
bool
(Optional) If true, instructs the transaction to be excluded from being recorded in change streams with the DDL option |
isolation_level |
IsolationLevel
(Optional) Sets isolation level for the transaction. |
read_lock_mode |
ReadLockMode
(Optional) Sets the read lock mode for this transaction. |
timeout_secs |
int
(Optional) The default time in seconds to wait before re-trying the commit.. |
| Exceptions | |
|---|---|
| Type | Description |
ValueError |
if the transaction is not ready to commit. |
| Returns | |
|---|---|
| Type | Description |
datetime |
timestamp of the committed changes. |