Class PartialRowData (2.21.0)

PartialRowData(row_key)

Representation of partial row in a Google Cloud Bigtable Table.

These are expected to be updated directly from a ._generated.bigtable_service_messages_pb2.ReadRowsResponse

Parameter

NameDescription
row_key bytes

The key for the row holding the (partial) data.

Properties

cells

Property returning all the cells accumulated on this partial row.

For example:

.. literalinclude:: snippets_table.py :start-after: [START bigtable_api_row_data_cells] :end-before: [END bigtable_api_row_data_cells] :dedent: 4

Returns
TypeDescription
dictDictionary of the Cell objects accumulated. This dictionary has two-levels of keys (first for column families and second for column names/qualifiers within a family). For a given column, a list of Cell objects is stored.

row_key

Getter for the current (partial) row's key.

Returns
TypeDescription
bytesThe current (partial) row's key.

Methods

cell_value

cell_value(column_family_id, column, index=0)

Get a single cell value stored on this instance.

For example:

.. literalinclude:: snippets_table.py :start-after: [START bigtable_api_row_cell_value] :end-before: [END bigtable_api_row_cell_value] :dedent: 4

Parameters
NameDescription
column_family_id str

The ID of the column family. Must be of the form <code>_a-zA-Z0-9][-_.a-zA-Z0-9]</code>*.

column bytes

The column within the column family where the cell is located.

index Optional[int]

The offset within the series of values. If not specified, will return the first cell.

Exceptions
TypeDescription
KeyErrorIf column_family_id is not among the cells stored in this row.
KeyErrorIf column is not among the cells stored in this row for the given column_family_id.
IndexErrorIf index cannot be found within the cells stored in this row for the given column_family_id, column pair.
Returns
TypeDescription
Cell valueThe cell value stored in the specified column and specified index.

cell_values

cell_values(column_family_id, column, max_count=None)

Get a time series of cells stored on this instance.

For example:

.. literalinclude:: snippets_table.py :start-after: [START bigtable_api_row_cell_values] :end-before: [END bigtable_api_row_cell_values] :dedent: 4

Parameters
NameDescription
column_family_id str

The ID of the column family. Must be of the form <code>_a-zA-Z0-9][-_.a-zA-Z0-9]</code>*.

column bytes

The column within the column family where the cells are located.

max_count int

The maximum number of cells to use.

Exceptions
TypeDescription
KeyErrorIf column_family_id is not among the cells stored in this row.
KeyErrorIf column is not among the cells stored in this row for the given column_family_id.
Returns
TypeDescription
A generator which providescell.value, cell.timestamp_micros for each cell in the list of cells

find_cells

find_cells(column_family_id, column)

Get a time series of cells stored on this instance.

For example:

.. literalinclude:: snippets_table.py :start-after: [START bigtable_api_row_find_cells] :end-before: [END bigtable_api_row_find_cells] :dedent: 4

Parameters
NameDescription
column_family_id str

The ID of the column family. Must be of the form <code>_a-zA-Z0-9][-_.a-zA-Z0-9]</code>*.

column bytes

The column within the column family where the cells are located.

Exceptions
TypeDescription
KeyErrorIf column_family_id is not among the cells stored in this row.
KeyErrorIf column is not among the cells stored in this row for the given column_family_id.
Returns
TypeDescription
List[Cell]The cells stored in the specified column.

to_dict

to_dict()

Convert the cells to a dictionary.

This is intended to be used with HappyBase, so the column family and column qualiers are combined (with :).

Returns
TypeDescription
dictDictionary containing all the data in the cells of this row.