TableBatch Class

This is the class that is used for batch operation for storage table service.

The Table service supports batch transactions on entities that are in the same table and belong to the same partition group. Multiple operations are supported within a single transaction. The batch can include at most 100 entities, and its total payload may be no more than 4 MB in size.

Inheritance
builtins.object
TableBatch

Constructor

TableBatch(require_encryption=False, key_encryption_key=None, encryption_resolver=None)

Parameters

Name Description
require_encryption
default value: False
key_encryption_key
default value: None
encryption_resolver
default value: None

Methods

delete_entity

Adds a delete entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.delete_entity> for more information on deletes.

The operation will not be executed until the batch is committed.

insert_entity

Adds an insert entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.insert_entity> for more information on inserts.

The operation will not be executed until the batch is committed.

insert_or_merge_entity

Adds an insert or merge entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.insert_or_merge_entity> for more information on insert or merge operations.

The operation will not be executed until the batch is committed.

insert_or_replace_entity

Adds an insert or replace entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.insert_or_replace_entity> for more information on insert or replace operations.

The operation will not be executed until the batch is committed.

merge_entity

Adds a merge entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.merge_entity> for more information on merges.

The operation will not be executed until the batch is committed.

update_entity

Adds an update entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.update_entity> for more information on updates.

The operation will not be executed until the batch is committed.

delete_entity

Adds a delete entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.delete_entity> for more information on deletes.

The operation will not be executed until the batch is committed.

delete_entity(partition_key, row_key, if_match='*')

Parameters

Name Description
partition_key
Required
str

The PartitionKey of the entity.

row_key
Required
str

The RowKey of the entity.

if_match
str

The client may specify the ETag for the entity on the request in order to compare to the ETag maintained by the service for the purpose of optimistic concurrency. The delete operation will be performed only if the ETag sent by the client matches the value maintained by the server, indicating that the entity has not been modified since it was retrieved by the client. To force an unconditional delete, set If-Match to the wildcard character (*).

default value: *

insert_entity

Adds an insert entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.insert_entity> for more information on inserts.

The operation will not be executed until the batch is committed.

insert_entity(entity)

Parameters

Name Description
entity
Required
<xref:azure.storage.table.models.Entity>

The entity to insert. Could be a dict or an entity object. Must contain a PartitionKey and a RowKey.

insert_or_merge_entity

Adds an insert or merge entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.insert_or_merge_entity> for more information on insert or merge operations.

The operation will not be executed until the batch is committed.

insert_or_merge_entity(entity)

Parameters

Name Description
entity
Required
<xref:azure.storage.table.models.Entity>

The entity to insert or merge. Could be a dict or an entity object. Must contain a PartitionKey and a RowKey.

insert_or_replace_entity

Adds an insert or replace entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.insert_or_replace_entity> for more information on insert or replace operations.

The operation will not be executed until the batch is committed.

insert_or_replace_entity(entity)

Parameters

Name Description
entity
Required
<xref:azure.storage.table.models.Entity>

The entity to insert or replace. Could be a dict or an entity object. Must contain a PartitionKey and a RowKey.

merge_entity

Adds a merge entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.merge_entity> for more information on merges.

The operation will not be executed until the batch is committed.

merge_entity(entity, if_match='*')

Parameters

Name Description
entity
Required
<xref:azure.storage.table.models.Entity>

The entity to merge. Could be a dict or an entity object. Must contain a PartitionKey and a RowKey.

if_match
str

The client may specify the ETag for the entity on the request in order to compare to the ETag maintained by the service for the purpose of optimistic concurrency. The merge operation will be performed only if the ETag sent by the client matches the value maintained by the server, indicating that the entity has not been modified since it was retrieved by the client. To force an unconditional merge, set If-Match to the wildcard character (*).

default value: *

update_entity

Adds an update entity operation to the batch. See <xref:azure.storage.table.tableservice.TableService.update_entity> for more information on updates.

The operation will not be executed until the batch is committed.

update_entity(entity, if_match='*')

Parameters

Name Description
entity
Required
<xref:azure.storage.table.models.Entity>

The entity to update. Could be a dict or an entity object. Must contain a PartitionKey and a RowKey.

if_match
str

The client may specify the ETag for the entity on the request in order to compare to the ETag maintained by the service for the purpose of optimistic concurrency. The update operation will be performed only if the ETag sent by the client matches the value maintained by the server, indicating that the entity has not been modified since it was retrieved by the client. To force an unconditional update, set If-Match to the wildcard character (*).

default value: *