As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Mutations

class google.cloud.bigtable.data.mutations.DeleteAllFromFamily(family_to_delete: str)[source]

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[source]

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: int | None = None, end_timestamp_micros: int | None = None)[source]

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[source]

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__() str[source]

Return a string representation of the mutation.

Returns

A string representation of the mutation.

Return type

str

is_idempotent() bool[source]

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

bool

size() int[source]

Get the size of the mutation in bytes

Returns

The size of the mutation in bytes.

Return type

int

class google.cloud.bigtable.data.mutations.RowMutationEntry(row_key: bytes | str, mutations: Mutation | list[Mutation])[source]

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() bool[source]

Check if all mutations in the entry are idempotent.

Returns

True if all mutations in the entry are idempotent, False otherwise.

Return type

bool

size() int[source]

Get the size of the mutation entry in bytes.

Returns

The size of the mutation entry in bytes.

Return type

int

class google.cloud.bigtable.data.mutations.SetCell(family: str, qualifier: bytes | str, new_value: bytes | str | int, timestamp_micros: int | None = None)[source]

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() bool[source]

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

bool