Python 3.10 is now available in preview.


A filter that isolates correlated values and applies a sub-filter on them.

Inherits From: FilterPredicate, expected_type

This filter assumes that every property used by the sub-filter should be grouped before being passed to the sub-filter. The default grouping puts each value in its own group. Consider: e = {a: [1, 2], b: [2, 1, 3], c: 4}

A correlation filter with a sub-filter that operates on (a, b) will be tested against the following 3 sets of values: {a: 1, b: 2} {a: 2, b: 1} {b: 3}

In this case CorrelationFilter('a = 2 AND b = 2') won't match this entity but CorrelationFilter('a = 2 AND b = 1') will. To apply an uncorrelated filter on c, the filter must be applied in parallel to the correlation filter. For example: CompositeFilter(AND, [CorrelationFilter('a = 2 AND b = 1'), 'c = 3'])

If 'c = 3' was included in the correlation filter, c would be grouped as well. This would result in the following values: {a: 1, b: 2, c: 3} {a: 2, b: 1} {b: 3}

If any set of correlated values match the sub-filter then the entity matches the correlation filter.

subfilter A FilterPredicate to apply to the correlated values




View source

Applies the filter predicate to the given entity.

entity the datastore_pb.EntityProto to test.

True if the given entity matches the filter, False otherwise.


View source

Return self==value.


View source

Return self!=value.