Allows users to send batches using context manager API.
Runs mutate_row, mutate_rows, and check_and_mutate_row internally, combining
to use as few network requests as required
Will automatically flush the batcher:
every flush_interval seconds
after queue size reaches flush_limit_mutation_count
after queue reaches flush_limit_bytes
when batcher is closed or destroyed
Parameters
table – table or autrhorized_view used to preform rpc calls
flush_interval – Automatically flush every flush_interval seconds.
If None, no time-based flushing is performed.
flush_limit_mutation_count – Flush immediately after flush_limit_mutation_count
mutations are added across all entries. If None, this limit is ignored.
flush_limit_bytes – Flush immediately after flush_limit_bytes bytes are added.
flow_control_max_mutation_count – Maximum number of inflight mutations.
flow_control_max_bytes – Maximum number of inflight bytes.
batch_operation_timeout – timeout for each mutate_rows operation, in seconds.
If TABLE_DEFAULT, defaults to the Table’s default_mutate_rows_operation_timeout.
batch_attempt_timeout – timeout for each individual request, in seconds.
If TABLE_DEFAULT, defaults to the Table’s default_mutate_rows_attempt_timeout.
If None, defaults to batch_operation_timeout.
batch_retryable_errors – a list of errors that will be retried if encountered.
Defaults to the Table’s default_mutate_rows_retryable_errors.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["Version latestkeyboard_arrow_down\n\n- [2.32.0 (latest)](/python/docs/reference/bigtable/latest/sync_data_mutations_batcher)\n- [2.31.0](/python/docs/reference/bigtable/2.31.0/sync_data_mutations_batcher)\n- [2.30.1](/python/docs/reference/bigtable/2.30.1/sync_data_mutations_batcher)\n- [2.29.0](/python/docs/reference/bigtable/2.29.0/sync_data_mutations_batcher)\n- [2.28.1](/python/docs/reference/bigtable/2.28.1/sync_data_mutations_batcher)\n- [2.26.0](/python/docs/reference/bigtable/2.26.0/sync_data_mutations_batcher)\n- [2.25.0](/python/docs/reference/bigtable/2.25.0/sync_data_mutations_batcher)\n- [2.24.0](/python/docs/reference/bigtable/2.24.0/sync_data_mutations_batcher)\n- [2.23.1](/python/docs/reference/bigtable/2.23.1/sync_data_mutations_batcher)\n- [2.22.0](/python/docs/reference/bigtable/2.22.0/sync_data_mutations_batcher)\n- [2.21.0](/python/docs/reference/bigtable/2.21.0/sync_data_mutations_batcher)\n- [2.20.0](/python/docs/reference/bigtable/2.20.0/sync_data_mutations_batcher)\n- [2.19.0](/python/docs/reference/bigtable/2.19.0/sync_data_mutations_batcher)\n- [2.18.1](/python/docs/reference/bigtable/2.18.1/sync_data_mutations_batcher)\n- [2.17.0](/python/docs/reference/bigtable/2.17.0/sync_data_mutations_batcher)\n- [2.16.0](/python/docs/reference/bigtable/2.16.0/sync_data_mutations_batcher)\n- [2.15.0](/python/docs/reference/bigtable/2.15.0/sync_data_mutations_batcher)\n- [2.14.1](/python/docs/reference/bigtable/2.14.1/sync_data_mutations_batcher)\n- [2.13.2](/python/docs/reference/bigtable/2.13.2/sync_data_mutations_batcher)\n- [2.12.0](/python/docs/reference/bigtable/2.12.0/sync_data_mutations_batcher)\n- [2.11.3](/python/docs/reference/bigtable/2.11.3/sync_data_mutations_batcher)\n- [2.10.1](/python/docs/reference/bigtable/2.10.1/sync_data_mutations_batcher)\n- [2.9.0](/python/docs/reference/bigtable/2.9.0/sync_data_mutations_batcher)\n- [2.8.1](/python/docs/reference/bigtable/2.8.1/sync_data_mutations_batcher)\n- [2.7.1](/python/docs/reference/bigtable/2.7.1/sync_data_mutations_batcher)\n- [2.6.0](/python/docs/reference/bigtable/2.6.0/sync_data_mutations_batcher)\n- [2.5.2](/python/docs/reference/bigtable/2.5.2/sync_data_mutations_batcher)\n- [2.4.0](/python/docs/reference/bigtable/2.4.0/sync_data_mutations_batcher)\n- [2.3.3](/python/docs/reference/bigtable/2.3.3/sync_data_mutations_batcher)\n- [2.2.0](/python/docs/reference/bigtable/2.2.0/sync_data_mutations_batcher)\n- [2.1.0](/python/docs/reference/bigtable/2.1.0/sync_data_mutations_batcher)\n- [2.0.0](/python/docs/reference/bigtable/2.0.0/sync_data_mutations_batcher)\n- [1.7.3](/python/docs/reference/bigtable/1.7.3/sync_data_mutations_batcher)\n- [1.6.1](/python/docs/reference/bigtable/1.6.1/sync_data_mutations_batcher)\n- [1.5.1](/python/docs/reference/bigtable/1.5.1/sync_data_mutations_batcher)\n- [1.4.0](/python/docs/reference/bigtable/1.4.0/sync_data_mutations_batcher)\n- [1.3.0](/python/docs/reference/bigtable/1.3.0/sync_data_mutations_batcher)\n- [1.2.1](/python/docs/reference/bigtable/1.2.1/sync_data_mutations_batcher)\n- [1.1.0](/python/docs/reference/bigtable/1.1.0/sync_data_mutations_batcher)\n- [1.0.0](/python/docs/reference/bigtable/1.0.0/sync_data_mutations_batcher)\n- [0.34.0](/python/docs/reference/bigtable/0.34.0/sync_data_mutations_batcher) \n\nMutations Batcher\n=================\n\n### *class* google.cloud.bigtable.data._sync_autogen.mutations_batcher.MutationsBatcher(table: TargetType, \\*, flush_interval: [float](https://docs.python.org/3/library/functions.html#float) \\| [None](https://docs.python.org/3/library/constants.html#None) = 5, flush_limit_mutation_count: [int](https://docs.python.org/3/library/functions.html#int) \\| [None](https://docs.python.org/3/library/constants.html#None) = 1000, flush_limit_bytes: [int](https://docs.python.org/3/library/functions.html#int) = 20971520, flow_control_max_mutation_count: [int](https://docs.python.org/3/library/functions.html#int) = 100000, flow_control_max_bytes: [int](https://docs.python.org/3/library/functions.html#int) = 104857600, batch_operation_timeout: [float](https://docs.python.org/3/library/functions.html#float) \\| TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS, batch_attempt_timeout: [float](https://docs.python.org/3/library/functions.html#float) \\| [None](https://docs.python.org/3/library/constants.html#None) \\| TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS, batch_retryable_errors: Sequence\\[[type](https://docs.python.org/3/library/functions.html#type)\\[[Exception](https://docs.python.org/3/library/exceptions.html#Exception)\\]\\] \\| TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS)\n\nBases: [`object`](https://docs.python.org/3/library/functions.html#object)\n\nAllows users to send batches using context manager API.\n\nRuns mutate_row, mutate_rows, and check_and_mutate_row internally, combining\nto use as few network requests as required\n\nWill automatically flush the batcher:\n\n- every flush_interval seconds\n- after queue size reaches flush_limit_mutation_count\n- after queue reaches flush_limit_bytes\n- when batcher is closed or destroyed\n\n- **Parameters**\n\n - **table** -- table or autrhorized_view used to preform rpc calls\n\n - **flush_interval** -- Automatically flush every flush_interval seconds.\n If None, no time-based flushing is performed.\n\n - **flush_limit_mutation_count** -- Flush immediately after flush_limit_mutation_count\n mutations are added across all entries. If None, this limit is ignored.\n\n - **flush_limit_bytes** -- Flush immediately after flush_limit_bytes bytes are added.\n\n - **flow_control_max_mutation_count** -- Maximum number of inflight mutations.\n\n - **flow_control_max_bytes** -- Maximum number of inflight bytes.\n\n - **batch_operation_timeout** -- timeout for each mutate_rows operation, in seconds.\n If TABLE_DEFAULT, defaults to the Table's default_mutate_rows_operation_timeout.\n\n - **batch_attempt_timeout** -- timeout for each individual request, in seconds.\n If TABLE_DEFAULT, defaults to the Table's default_mutate_rows_attempt_timeout.\n If None, defaults to batch_operation_timeout.\n\n - **batch_retryable_errors** -- a list of errors that will be retried if encountered.\n Defaults to the Table's default_mutate_rows_retryable_errors.\n\n#### _*enter_*()\n\nAllow use of context manager API\n\n#### _*exit_*(exc_type, exc, tb)\n\nAllow use of context manager API.\n\nFlushes the batcher and cleans up resources.\n\n#### append(mutation_entry: [RowMutationEntry](/python/docs/reference/bigtable/latest/common_data_mutations#google.cloud.bigtable.data.mutations.RowMutationEntry))\n\nAdd a new set of mutations to the internal queue\n\n- **Parameters**\n\n **mutation_entry** -- new entry to add to flush queue\n- **Raises**\n\n - [**RuntimeError**](https://docs.python.org/3/library/exceptions.html#RuntimeError) -- if batcher is closed\n\n - [**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError) -- if an invalid mutation type is added\n\n#### close()\n\nFlush queue and clean up resources\n\n#### *property* closed(*: \\[bool\\](\u003chttps://docs.python.org/3/library/functions.html#bool\u003e* )\n\nReturns:\n\n- True if the batcher is closed, False otherwise"]]