Mutations
class google.cloud.bigtable.data.mutations.DeleteAllFromFamily(family_to_delete: str)
Bases: google.cloud.bigtable.data.mutations.Mutation
Mutation to delete all cells from a column family.
Parameters
family_to_delete – The name of the column family to delete.
class google.cloud.bigtable.data.mutations.DeleteAllFromRow()
Bases: google.cloud.bigtable.data.mutations.Mutation
Mutation to delete all cells from a row.
class google.cloud.bigtable.data.mutations.DeleteRangeFromColumn(family: str, qualifier: bytes, start_timestamp_micros: Optional[int] = None, end_timestamp_micros: Optional[int] = None)
Bases: google.cloud.bigtable.data.mutations.Mutation
Mutation to delete a range of cells from a column.
Parameters
family – The name of the column family. qualifier: The column qualifier.
start_timestamp_micros – The start timestamp of the range to delete. None represents 0. Defaults to None.
end_timestamp_micros – The end timestamp of the range to delete. None represents infinity. Defaults to None.
Raises
ValueError – If start_timestamp_micros is greater than end_timestamp_micros.
class google.cloud.bigtable.data.mutations.Mutation()
Bases: abc.ABC
Abstract base class for mutations.
This class defines the interface for different types of mutations that can be applied to Bigtable rows.
_str_()
Return a string representation of the mutation.
Returns
A string representation of the mutation.
Return type
is_idempotent()
Check if the mutation is idempotent
Idempotent mutations can be safely retried on failure.
Returns
True if the mutation is idempotent, False otherwise.
Return type
size()
Get the size of the mutation in bytes
Returns
The size of the mutation in bytes.
Return type
class google.cloud.bigtable.data.mutations.RowMutationEntry(row_key: bytes | str, mutations: google.cloud.bigtable.data.mutations.Mutation | list[google.cloud.bigtable.data.mutations.Mutation])
Bases: object
A single entry in a MutateRows request.
This class represents a set of mutations to apply to a specific row in a Bigtable table.
Parameters
row_key – The key of the row to mutate.
mutations – The mutation or list of mutations to apply to the row.
Raises
ValueError – If mutations is empty or contains more than _MUTATE_ROWS_REQUEST_MUTATION_LIMIT mutations.
is_idempotent()
Check if all mutations in the entry are idempotent.
Returns
True if all mutations in the entry are idempotent, False otherwise.
Return type
size()
Get the size of the mutation entry in bytes.
Returns
The size of the mutation entry in bytes.
Return type
class google.cloud.bigtable.data.mutations.SetCell(family: str, qualifier: bytes | str, new_value: bytes | str | int, timestamp_micros: Optional[int] = None)
Bases: google.cloud.bigtable.data.mutations.Mutation
Mutation to set the value of a cell.
Parameters
family – The name of the column family to which the new cell belongs.
qualifier – The column qualifier of the new cell.
new_value – The value of the new cell.
timestamp_micros – The timestamp of the new cell. If None, the current timestamp will be used. Timestamps will be sent with millisecond precision. Extra precision will be truncated. If -1, the server will assign a timestamp. Note that SetCell mutations with server-side timestamps are non-idempotent operations and will not be retried.
Raises
TypeError – If qualifier is not bytes or str.
TypeError – If new_value is not bytes, str, or int.
ValueError – If timestamp_micros is less than _SERVER_SIDE_TIMESTAMP.
is_idempotent()
Check if the mutation is idempotent
Idempotent mutations can be safely retried on failure.
Returns
True if the mutation is idempotent, False otherwise.
Return type