Filters for Google Cloud Bigtable Row classes.
Classes
ApplyLabelFilter
ApplyLabelFilter(label)
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.
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 |
BlockAllFilter
BlockAllFilter(flag)
Row filter that doesn't match any cells.
Name | Description |
flag |
bool
Does not match any cells, regardless of input. Useful for temporarily disabling just part of a filter. |
CellsColumnLimitFilter
CellsColumnLimitFilter(num_cells)
Row filter to limit cells in a column.
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
CellsRowLimitFilter(num_cells)
Row filter to limit cells in a row.
Name | Description |
num_cells |
int
Matches only the first N cells of the row. |
CellsRowOffsetFilter
CellsRowOffsetFilter(num_cells)
Row filter to skip cells in a row.
Name | Description |
num_cells |
int
Skips the first N cells of the row. |
ColumnQualifierRegexFilter
ColumnQualifierRegexFilter(regex)
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
Name | Description |
regex |
bytes
A regular expression (RE2) to match cells from column that match this regex (irrespective of column family). |
ColumnRangeFilter
ColumnRangeFilter(
column_family_id,
start_column=None,
end_column=None,
inclusive_start=None,
inclusive_end=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.
Name | Description |
column_family_id |
str
The column family that contains the columns. Must be of the form |
start_column |
bytes
The start of the range of columns. If no value is used, the backend applies no upper bound to the values. |
end_column |
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: |
inclusive_end |
bool
Boolean indicating if the end column should be included in the range (or excluded). Defaults to :data: |
Type | Description |
`ValueErro |
ConditionalRowFilter
ConditionalRowFilter(base_filter, true_filter=None, false_filter=None)
Conditional row filter which exhibits ternary behavior.
Executes one of two filters based on another filter. If the base_filter
returns any cells in the row, then true_filter
is executed. If not,
then false_filter
is executed.
Name | Description |
base_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 |
false_filter |
`RowFilter`
(Optional) The filter to execute if there are no cells matching |
ExactValueFilter
ExactValueFilter(value)
Row filter for an exact value.
Name | Description |
value |
bytes or str or int
a literal string encodable as ASCII, or the equivalent bytes, or an integer (which will be packed into 8-bytes). |
FamilyNameRegexFilter
FamilyNameRegexFilter(regex)
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
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 |
PassAllFilter
PassAllFilter(flag)
Row filter equivalent to not filtering at all.
Name | Description |
flag |
bool
Matches all cells, regardless of input. Functionally equivalent to leaving |
RowFilter
RowFilter()
Basic filter to apply to cells in a row.
These values can be combined via RowFilterChain
,
RowFilterUnion
and ConditionalRowFilter
.
RowFilterChain
RowFilterChain(filters=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.
Name | Description |
filters |
list
List of |
RowFilterUnion
RowFilterUnion(filters=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.
Name | Description |
filters |
list
List of |
RowKeyRegexFilter
RowKeyRegexFilter(regex)
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
Name | Description |
regex |
bytes
A regular expression (RE2) to match cells from rows with row keys that satisfy this regex. For a |
RowSampleFilter
RowSampleFilter(sample)
Matches all cells from a row with probability p.
Name | Description |
sample |
float
The probability of matching a cell (must be in the interval |
SinkFilter
SinkFilter(flag)
Advanced row filter to skip parent filters.
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 |
StripValueTransformerFilter
StripValueTransformerFilter(flag)
Row filter that transforms cells into empty string (0 bytes).
Name | Description |
flag |
bool
If :data: |
TimestampRange
TimestampRange(start=None, end=None)
Range of time with inclusive lower and exclusive upper bounds.
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
TimestampRangeFilter(range_)
Row filter that limits cells to a range of time.
Name | Description |
range_ |
`TimestampRange`
Range of time that cells should match against. |
ValueRangeFilter
ValueRangeFilter(
start_value=None, end_value=None, inclusive_start=None, inclusive_end=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.
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: |
inclusive_end |
bool
Boolean indicating if the end value should be included in the range (or excluded). Defaults to :data: |
Type | Description |
`ValueErro |
ValueRegexFilter
ValueRegexFilter(regex)
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
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. |