Stay organized with collections Save and categorize content based on your preferences.
Bases: object
An Aggregation query against the Cloud Datastore.
This class serves as an abstraction for creating aggregations over query in the Cloud Datastore.
Parameters
client (google.cloud.datastore.client.Client
) – The client used to connect to Datastore.
query (google.cloud.datastore.query.Query
) – The query used for aggregations.
Adds an aggregation operation to the nested query
Parameters
aggregation (google.cloud.datastore.aggregation.BaseAggregation
) – An aggregation operation, e.g. a CountAggregation
Adds a list of aggregations to the nested query :type aggregations: list :param aggregations: a list of aggregation operations
count(alias=None)Adds a count over the nested query
Parameters
alias (str) – (Optional) The alias for the count
Execute the Aggregation Query; return an iterator for the aggregation results.
For example:
>>> andy = datastore.Entity(client.key('Person', 1234))
>>> andy['name'] = 'Andy'
>>> sally = datastore.Entity(client.key('Person', 2345))
>>> sally['name'] = 'Sally'
>>> bobby = datastore.Entity(client.key('Person', 3456))
>>> bobby['name'] = 'Bobby'
>>> client.put_multi([andy, sally, bobby])
>>> query = client.query(kind='Andy')
>>> aggregation_query = client.aggregation_query(query)
>>> result = aggregation_query.count(alias="total").fetch(limit=5)
>>> result
<google.cloud.datastore.aggregation.AggregationResultIterator object at ...>
Parameters
client (google.cloud.datastore.client.Client
) – (Optional) client used to connect to datastore. If not supplied, uses the query’s value.
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 (google.api_core.retry.Retry
) – A retry object used to retry requests. If None
is specified, requests will be retried using a default configuration.
timeout (float) – Time, in seconds, to wait for the request to complete. Note that if retry
is specified, the timeout applies to each individual attempt.
read_time (datetime) – (Optional) use read_time read consistency, cannot be used inside a transaction or with eventual consistency, or will raise ValueError.
Return type
AggregationIterator
Returns
The iterator for the aggregation query.
The nested query’s namespace
property project()Get the project for this AggregationQuery.
Return type
Returns
The project for the query.
Bases: object
A class representing result from Aggregation Query
Parameters
Bases: google.api_core.page_iterator.Iterator
Represent the state of a given execution of a Query.
Parameters
aggregation_query (AggregationQuery
) – AggregationQuery object holding permanent configuration (i.e. things that don’t change on with each page in a results set).
client (Client
) – The client used to make a request.
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 (google.api_core.retry.Retry
) – A retry object used to retry requests. If None
is specified, requests will be retried using a default configuration.
timeout (float) – Time, in seconds, to wait for the request to complete. Note that if retry
is specified, the timeout applies to each individual attempt.
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.
Bases: abc.ABC
Base class representing an Aggregation operation in Datastore
class google.cloud.datastore.aggregation.CountAggregation(alias=None)Bases: google.cloud.datastore.aggregation.BaseAggregation
Representation of a “Count” aggregation query.
Parameters
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4