Mutations
class google.cloud.bigtable.data.mutations.AddToCell(family: str , qualifier: bytes | str , value: int , timestamp_micros: int )
Bases: google.cloud.bigtable.data.mutations.Mutation
Adds an int64 value to an aggregate cell. The column family must be an aggregate family and have an “int64” input type or this mutation will be rejected.
Note: The timestamp values are in microseconds but must match the granularity of the table (defaults to MILLIS). Therefore, the given value must be a multiple of 1000 (millisecond granularity). For example: 1571902339435000.
-
Parameters
-
family– The name of the column family to which the cell belongs.
-
qualifier– The column qualifier of the cell.
-
value– The value to be accumulated into the cell.
-
timestamp_micros– The timestamp of the cell. Must be provided for cell aggregation to work correctly.
-
-
Raises
-
TypeError – If qualifier is not bytes or str.
-
TypeError – If value is not int.
-
TypeError – If timestamp_micros is not int.
-
ValueError – If value is out of bounds for a 64-bit signed int.
-
ValueError – If timestamp_micros is less than 0.
-
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
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