Skip to content

Latest commit

 

History

History
67 lines (52 loc) · 2.82 KB

File metadata and controls

67 lines (52 loc) · 2.82 KB

Bigtable Row Filters

It is possible to use a :class:`RowFilter <google.cloud.bigtable.row_filters.RowFilter>` when adding mutations to a :class:`ConditionalRow <google.cloud.bigtable.row.ConditionalRow>` and when reading row data with :meth:`read_row() <google.cloud.bigtable.table.Table.read_row>` or :meth:`read_rows() <google.cloud.bigtable.table.Table.read_rows>`.

As laid out in the RowFilter definition, the following basic filters are provided:

In addition, these filters can be combined into composite filters with

These rules can be nested arbitrarily, with a basic filter at the lowest level. For example:

# Filter in a specified column (matching any column family).
col1_filter = ColumnQualifierRegexFilter(b'columnbia')

# Create a filter to label results.
label1 = u'label-red'
label1_filter = ApplyLabelFilter(label1)

# Combine the filters to label all the cells in columnbia.
chain1 = RowFilterChain(filters=[col1_filter, label1_filter])

# Create a similar filter to label cells blue.
col2_filter = ColumnQualifierRegexFilter(b'columnseeya')
label2 = u'label-blue'
label2_filter = ApplyLabelFilter(label2)
chain2 = RowFilterChain(filters=[col2_filter, label2_filter])

# Bring our two labeled columns together.
row_filter = RowFilterUnion(filters=[chain1, chain2])

.. automodule:: google.cloud.bigtable.row_filters
  :members:
  :show-inheritance: