2.41.0 (latest) 2.40.0 2.39.0 2.38.0 2.37.0 2.36.0 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.1 2.29.0 2.28.1 2.26.0 2.25.0 2.24.0 2.23.1 2.22.0 2.21.0 2.20.0 2.19.0 2.18.1 2.17.0 2.16.0 2.15.0 2.14.1 2.13.2 2.12.0 2.11.3 2.10.1 2.9.0 2.8.1 2.7.1 2.6.0 2.5.2 2.4.0 2.3.3 2.2.0 2.1.0 2.0.0 1.7.3 1.6.1 1.5.1 1.4.0 1.3.0 1.2.1 1.1.0 1.0.0 0.34.0 Filters for Google Cloud Bigtable Row classes.

## Classes

### [ApplyLabelFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.ApplyLabelFilter)

    ApplyLabelFilter(label: str)

Filter to apply labels to cells.

Intended to be used as an intermediate filter on a pre-existing filtered
result set. This way if two sets are combined, the label can tell where
the cell(s) originated.This allows the client to determine which results
were produced from which part of the filter.

> [!NOTE]
> **Note:** Due to a technical limitation of the backend, it is not currently possible to apply multiple labels to a cell.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `label` | `str` Label to apply to cells in the output row. Values must be at most 15 characters long, and match the pattern `[a-z0-9-]+`. |

### [BlockAllFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.BlockAllFilter)

    BlockAllFilter(flag: bool)

Row filter that doesn't match any cells.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `flag` | `bool` Does not match any cells, regardless of input. Useful for temporarily disabling just part of a filter. |

### [CellsColumnLimitFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.CellsColumnLimitFilter)

    CellsColumnLimitFilter(num_cells: int)

Row filter to limit cells in a column.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `num_cells` | `int` Matches only the most recent N cells within each column. This filters a (family name, column) pair, based on timestamps of each cell. |

### [CellsRowLimitFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.CellsRowLimitFilter)

    CellsRowLimitFilter(num_cells: int)

Row filter to limit cells in a row.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `num_cells` | `int` Matches only the first N cells of the row. |

### [CellsRowOffsetFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.CellsRowOffsetFilter)

    CellsRowOffsetFilter(num_cells: int)

Row filter to skip cells in a row.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `num_cells` | `int` Skips the first N cells of the row. |

### [ColumnQualifierRegexFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.ColumnQualifierRegexFilter)

    ColumnQualifierRegexFilter(regex: str | bytes)

Row filter for a column qualifier regular expression.

The `regex` must be valid RE2 patterns. See Google's
`RE2 reference`_ for the accepted syntax.

.. _RE2 reference: <https://github.com/google/re2/wiki/Syntax>

> [!NOTE]
> **Note:** Special care need be used with the expression used. Since each of these properties can contain arbitrary bytes, the `\C` escape sequence must be used if a true wildcard is desired. The `.` character will not match the new line character `\n`, which may be present in a binary value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `regex` | `bytes` A regular expression (RE2) to match cells from column that match this regex (irrespective of column family). |

### [ColumnRangeFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.ColumnRangeFilter)

    ColumnRangeFilter(
        family_id: str,
        start_qualifier: typing.Optional[bytes] = None,
        end_qualifier: typing.Optional[bytes] = None,
        inclusive_start: typing.Optional[bool] = None,
        inclusive_end: typing.Optional[bool] = None,
    )

A row filter to restrict to a range of columns.

Both the start and end column can be included or excluded in the range.
By default, we include them both, but this can be changed with optional
flags.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `family_id` | `str` The column family that contains the columns. Must be of the form `<code>_a-zA-Z0-9][-_.a-zA-Z0-9]</code>*`. |
| `start_qualifier` | `bytes` The start of the range of columns. If no value is used, the backend applies no upper bound to the values. |
| `end_qualifier` | `bytes` The end of the range of columns. If no value is used, the backend applies no upper bound to the values. |
| `inclusive_start` | `bool` Boolean indicating if the start column should be included in the range (or excluded). Defaults to :data:`True` if `start_qualifier` is passed and no `inclusive_start` was given. |
| `inclusive_end` | `bool` Boolean indicating if the end column should be included in the range (or excluded). Defaults to :data:`True` if `end_qualifier` is passed and no `inclusive_end` was given. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `` `ValueErro `` |   |

### [ConditionalRowFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.ConditionalRowFilter)

    ConditionalRowFilter(
        predicate_filter: google.cloud.bigtable.data.row_filters.RowFilter,
        true_filter: typing.Optional[
            google.cloud.bigtable.data.row_filters.RowFilter
        ] = None,
        false_filter: typing.Optional[
            google.cloud.bigtable.data.row_filters.RowFilter
        ] = None,
    )

Conditional row filter which exhibits ternary behavior.

Executes one of two filters based on another filter. If the `predicate_filter`
returns any cells in the row, then `true_filter` is executed. If not,
then `false_filter` is executed.

> [!NOTE]
> **Note:** The `predicate_filter` does not execute atomically with the true and false filters, which may lead to inconsistent or unexpected results. Additionally, executing a `ConditionalRowFilter` has poor performance on the server, especially when `false_filter` is set.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `predicate_filter` | `` `RowFilter` `` The filter to condition on before executing the true/false filters. |
| `true_filter` | `` `RowFilter` `` (Optional) The filter to execute if there are any cells matching `predicate_filter`. If not provided, no results will be returned in the true case. |
| `false_filter` | `` `RowFilter` `` (Optional) The filter to execute if there are no cells matching `predicate_filter`. If not provided, no results will be returned in the false case. |

### [FamilyNameRegexFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.FamilyNameRegexFilter)

    FamilyNameRegexFilter(regex: str | bytes)

Row filter for a family name regular expression.

The `regex` must be valid RE2 patterns. See Google's
`RE2 reference`_ for the accepted syntax.

.. _RE2 reference: <https://github.com/google/re2/wiki/Syntax>

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `regex` | `str` A regular expression (RE2) to match cells from columns in a given column family. For technical reasons, the regex must not contain the `':'` character, even if it is not being used as a literal. |

### [LiteralValueFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.LiteralValueFilter)

    LiteralValueFilter(value: bytes | str | int)

Row filter for an exact value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `bytes or str or int` a literal string, integer, or the equivalent bytes. Integer values will be packed into signed 8-bytes. |

### [PassAllFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.PassAllFilter)

    PassAllFilter(flag: bool)

Row filter equivalent to not filtering at all.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `flag` | `bool` Matches all cells, regardless of input. Functionally equivalent to leaving `filter` unset, but included for completeness. |

### [RowFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.RowFilter)

    RowFilter()

Basic filter to apply to cells in a row.

These values can be combined via `RowFilterChain`,
`RowFilterUnion` and `ConditionalRowFilter`.

> [!NOTE]
> **Note:** This class is a do-nothing base class for all row filters.

### [RowFilterChain](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.RowFilterChain)

    RowFilterChain(
        filters: typing.Optional[
            list[google.cloud.bigtable.data.row_filters.RowFilter]
        ] = None,
    )

Chain of row filters.

Sends rows through several filters in sequence. The filters are "chained"
together to process a row. After the first filter is applied, the second
is applied to the filtered output and so on for subsequent filters.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `filters` | `list` List of `RowFilter` |

### [RowFilterUnion](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.RowFilterUnion)

    RowFilterUnion(
        filters: typing.Optional[
            list[google.cloud.bigtable.data.row_filters.RowFilter]
        ] = None,
    )

Union of row filters.

Sends rows through several filters simultaneously, then
merges / interleaves all the filtered results together.

If multiple cells are produced with the same column and timestamp,
they will all appear in the output row in an unspecified mutual order.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `filters` | `list` List of `RowFilter` |

### [RowKeyRegexFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.RowKeyRegexFilter)

    RowKeyRegexFilter(regex: str | bytes)

Row filter for a row key regular expression.

The `regex` must be valid RE2 patterns. See Google's
`RE2 reference`_ for the accepted syntax.

.. _RE2 reference: <https://github.com/google/re2/wiki/Syntax>

> [!NOTE]
> **Note:** Special care need be used with the expression used. Since each of these properties can contain arbitrary bytes, the `\C` escape sequence must be used if a true wildcard is desired. The `.` character will not match the new line character `\n`, which may be present in a binary value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `regex` | `bytes` A regular expression (RE2) to match cells from rows with row keys that satisfy this regex. For a `CheckAndMutateRowRequest`, this filter is unnecessary since the row key is already specified. |

### [RowSampleFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.RowSampleFilter)

    RowSampleFilter(sample: float)

Matches all cells from a row with probability p.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `sample` | `float` The probability of matching a cell (must be in the interval `(0, 1)` The end points are excluded). |

### [SinkFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.SinkFilter)

    SinkFilter(flag: bool)

Advanced row filter to skip parent filters.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `flag` | `bool` ADVANCED USE ONLY. Hook for introspection into the row filter. Outputs all cells directly to the output of the read rather than to any parent filter. Cannot be used within the `predicate_filter`, `true_filter`, or `false_filter` of a `ConditionalRowFilter`. |

### [StripValueTransformerFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.StripValueTransformerFilter)

    StripValueTransformerFilter(flag: bool)

Row filter that transforms cells into empty string (0 bytes).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `flag` | `bool` If :data:`True`, replaces each cell's value with the empty string. As the name indicates, this is more useful as a transformer than a generic query / filter. |

### [TimestampRange](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.TimestampRange)

    TimestampRange(start: "datetime" | None = None, end: "datetime" | None = None)

Range of time with inclusive lower and exclusive upper bounds.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `start` | `` `datetime.datetime` `` (Optional) The (inclusive) lower bound of the timestamp range. If omitted, defaults to Unix epoch. |
| `end` | `` `datetime.datetime` `` (Optional) The (exclusive) upper bound of the timestamp range. If omitted, no upper bound is used. |

### [TimestampRangeFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.TimestampRangeFilter)

    TimestampRangeFilter(
        start: "datetime" | None = None, end: "datetime" | None = None
    )

Row filter that limits cells to a range of time.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `range_` | `` `TimestampRange` `` Range of time that cells should match against. |

### [ValueBitmaskFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.ValueBitmaskFilter)

    ValueBitmaskFilter(mask: bytes | str)

Row filter for a value bitmask.

Matches only cells with values that satisfy the condition
`(value & mask) == mask`. The mask length must exactly match the value
length, otherwise the cell is not considered a match.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `mask` | `bytes or str` A bitmask to match against cell values. String values will be encoded as ASCII. |

### [ValueRangeFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.ValueRangeFilter)

    ValueRangeFilter(
        start_value: typing.Optional[typing.Union[bytes, int]] = None,
        end_value: typing.Optional[typing.Union[bytes, int]] = None,
        inclusive_start: typing.Optional[bool] = None,
        inclusive_end: typing.Optional[bool] = None,
    )

A range of values to restrict to in a row filter.

Will only match cells that have values in this range.

Both the start and end value can be included or excluded in the range.
By default, we include them both, but this can be changed with optional
flags.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `start_value` | `bytes` The start of the range of values. If no value is used, the backend applies no lower bound to the values. |
| `end_value` | `bytes` The end of the range of values. If no value is used, the backend applies no upper bound to the values. |
| `inclusive_start` | `bool` Boolean indicating if the start value should be included in the range (or excluded). Defaults to :data:`True` if `start_value` is passed and no `inclusive_start` was given. |
| `inclusive_end` | `bool` Boolean indicating if the end value should be included in the range (or excluded). Defaults to :data:`True` if `end_value` is passed and no `inclusive_end` was given. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `` `ValueErro `` |   |

### [ValueRegexFilter](https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.data.row_filters.ValueRegexFilter)

    ValueRegexFilter(regex: str | bytes)

Row filter for a value regular expression.

The `regex` must be valid RE2 patterns. See Google's
`RE2 reference`_ for the accepted syntax.

.. _RE2 reference: <https://github.com/google/re2/wiki/Syntax>

> [!NOTE]
> **Note:** Special care need be used with the expression used. Since each of these properties can contain arbitrary bytes, the `\C` escape sequence must be used if a true wildcard is desired. The `.` character will not match the new line character `\n`, which may be present in a binary value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `regex` | `bytes or str` A regular expression (RE2) to match cells with values that match this regex. String values will be encoded as ASCII. |