Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

Python 3.10 is now generally available.

google.appengine.datastore.datastore_query.CorrelationFilter

Stay organized with collections Save and categorize content based on your preferences.

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

subfilter

Methods

__call__

View source

Applies the filter predicate to the given entity.

Args
entity the datastore_pb.EntityProto to test.

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

__eq__

View source

Return self==value.

__ne__

View source

Return self!=value.