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.apply_query

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

Performs the given query on a set of in-memory results.

This function can perform queries impossible in the datastore (e.g a query with multiple inequality filters on different properties) because all operations are done in memory. For queries that can also be executed on the the datastore, the results produced by this function may not use the same implicit ordering as the datastore. To ensure compatibility, explicit ordering must be used (e.g. 'ORDER BY ineq_prop, ..., key').

Order by key should always be used when a consistent result is desired (unless there is a sort order on another globally unique property).

query a datastore_query.Query to apply
entities a list of results, of arbitrary type, on which to apply the query.
_key a function that takes an element of the result array as an argument and must return an entity_pb2.EntityProto. If not specified, the identity function is used (and entities must be a list of entity_pb2.EntityProto).

A subset of entities, filtered and ordered according to the query.