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.

Rows and Cells

class google.cloud.bigtable.data.row.Cell(value: bytes, row_key: bytes, family: str, qualifier: bytes | str, timestamp_micros: int, labels: list[str] | None = None)[source]

Bases: object

Model class for cell data

Does not represent all data contained in the cell, only data returned by a query. Expected to be read-only to users, and written by backend

Cell constructor

Cell objects are not intended to be constructed by users. They are returned by the Bigtable backend.

__eq__(other) bool[source]

Implements == operator

__hash__()[source]

Implements hash() function to fingerprint cell

__int__() int[source]

Allows casting cell to int Interprets value as a 64-bit big-endian signed integer, as expected by ReadModifyWrite increment rule

__lt__(other) bool[source]

Implements < operator

__ne__(other) bool[source]

Implements != operator

__repr__()[source]

Returns a string representation of the cell

__str__() str[source]

Allows casting cell to str Prints encoded byte string, same as printing value directly.

class google.cloud.bigtable.data.row.Row(key: bytes, cells: list[google.cloud.bigtable.data.row.Cell])[source]

Bases: object

Model class for row data returned from server

Does not represent all data contained in the row, only data returned by a query. Expected to be read-only to users, and written by backend

Can be indexed: cells = row[“family”, “qualifier”]

Initializes a Row object

Row objects are not intended to be created by users. They are returned by the Bigtable backend.

__contains__(item)[source]

Implements in operator

Works for both cells in the internal list, and family or (family, qualifier) pairs associated with the cells

__eq__(other)[source]

Implements == operator

__getitem__(index: str | tuple[str, bytes | str]) list[google.cloud.bigtable.data.row.Cell][source]
__getitem__(index: int) google.cloud.bigtable.data.row.Cell
__getitem__(index: slice) list[google.cloud.bigtable.data.row.Cell]

Implements [] indexing

Supports indexing by family, (family, qualifier) pair, numerical index, and index slicing

__iter__()[source]

Allow iterating over all cells in the row

__len__()[source]

Implements len() operator

__ne__(other) bool[source]

Implements != operator

__str__() str[source]

Human-readable string representation

{
  (family='fam', qualifier=b'col'): [b'value', (+1 more),],
  (family='fam', qualifier=b'col2'): [b'other'],
}
get_cells(family: str | None = None, qualifier: str | bytes | None = None) list[Cell][source]
Returns cells sorted in Bigtable native order:
  • Family lexicographically ascending

  • Qualifier ascending

  • Timestamp in reverse chronological order

If family or qualifier not passed, will include all

Can also be accessed through indexing:

cells = row[“family”, “qualifier”] cells = row[“family”]