Module query (2.19.0) Stay organized with collections Save and categorize content based on your preferences.
Create / interact with Google Cloud Datastore queries.
Classes
And
And(filters)Class representation of an AND Filter.
BaseCompositeFilter
BaseCompositeFilter(operation=Operator.OPERATOR_UNSPECIFIED,filters=None)Base class for a Composite Filter. (either OR or AND).
BaseFilter
BaseFilter()Base class for Filters
Iterator
Iterator(query,client,limit=None,offset=None,start_cursor=None,end_cursor=None,eventual=False,retry=None,timeout=None,read_time=None,)Represent the state of a given execution of a Query.
| Parameters | |
|---|---|
| Name | Description |
query | QueryQuery object holding permanent configuration (i.e. things that don't change on with each page in a results set). |
client | ClientThe client used to make a request. |
limit | int(Optional) Limit the number of results returned. |
offset | int(Optional) Offset used to begin a query. |
start_cursor | bytes(Optional) Cursor to begin paging through query results. |
end_cursor | bytes(Optional) Cursor to end paging through query results. |
eventual | bool(Optional) Defaults to strongly consistent (False). Setting True will use eventual consistency, but cannot be used inside a transaction or with read_time, otherwise will raise ValueError. |
retry | A retry object used to retry requests. If |
timeout | floatTime, in seconds, to wait for the request to complete. Note that if |
read_time | datetime(Optional) Runs the query with read time consistency. Cannot be used with eventual consistency or inside a transaction, otherwise will raise ValueError. This feature is in private preview. |
Or
Or(filters)Class representation of an OR Filter.
PropertyFilter
PropertyFilter(property_name,operator,value)Class representation of a Property Filter
Query
Query(client,kind=None,project=None,namespace=None,ancestor=None,filters=(),projection=(),order=(),distinct_on=(),)A Query against the Cloud Datastore.
This class serves as an abstraction for creating a query over datastored in the Cloud Datastore.
| Parameters | |
|---|---|
| Name | Description |
client | ClientThe client used to connect to Datastore. |
kind | strThe kind to query. |
project | str(Optional) The project associated with the query. If not passed, uses the client's value. |
namespace | str(Optional) The namespace to which to restrict results. If not passed, uses the client's value. |
ancestor | Key(Optional) key of the ancestor to which this query's results are restricted. |
filters | tuple[str, str, str]Property filters applied by this query. The sequence is |
projection | sequence of stringfields returned as part of query results. |
order | sequence of stringfield names used to order query results. Prepend |
distinct_on | sequence of stringfield names used to group query results. |
| Exceptions | |
|---|---|
| Type | Description |
ValueErro | ifproject is not passed and no implicit default is set. |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-16 UTC.