Class PartialRowData (2.24.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

Name Description
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
Type Description
dict Dictionary 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
Type Description
bytes The 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
Name Description
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
Type Description
KeyError If column_family_id is not among the cells stored in this row.
KeyError If column is not among the cells stored in this row for the given column_family_id.
IndexError If index cannot be found within the cells stored in this row for the given column_family_id, column pair.
Returns
Type Description
Cell value The 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
Name Description
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
Type Description
KeyError If column_family_id is not among the cells stored in this row.
KeyError If column is not among the cells stored in this row for the given column_family_id.
Returns
Type Description
A generator which provides cell.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
Name Description
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
Type Description
KeyError If column_family_id is not among the cells stored in this row.
KeyError If column is not among the cells stored in this row for the given column_family_id.
Returns
Type Description
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
Type Description
dict Dictionary containing all the data in the cells of this row.