8000 docs: improve query API documentation (#430) · googleapis/python-datastore@915daf5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 915daf5

Browse files
docs: improve query API documentation (#430)
* feat: Add SUM/AVG aggregation query support in the preview branch and improve query API documentation PiperOrigin-RevId: 518940761 Source-Link: googleapis/googleapis@b1efb32 Source-Link: googleapis/googleapis-gen@f7c2054 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjdjMjA1NDE0YTVjNjU3OTQzOGI1ODA2ZDNkYzVmMjBkMDllZjgzYyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent da86a02 commit 915daf5

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

google/cloud/datastore_v1/types/entity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ class Entity(proto.Message):
373373
The entity's properties. The map's keys are property names.
374374
A property name matching regex ``__.*__`` is reserved. A
375375
reserved property name is forbidden in certain documented
376-
contexts. The name must not contain more than 500
377-
characters. The name cannot be ``""``.
376+
contexts. The map keys, represented as UTF-8, must not
377+
exceed 1,500 bytes and cannot be empty.
378378
"""
379379

380380
key: "Key" = proto.Field(

google/cloud/datastore_v1/types/query.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,16 @@ class Query(proto.Message):
146146
The order to apply to the query results (if
147147
empty, order is unspecified).
148148
distinct_on (MutableSequence[google.cloud.datastore_v1.types.PropertyReference]):
149-
The properties to make distinct. The query
150-
results will contain the first result for each
151-
distinct combination of values for the given
152-
properties (if empty, all results are returned).
149+
The properties to make distinct. The query results will
150+
contain the first result for each distinct combination of
151+
values for the given properties (if empty, all results are
152+
returned).
153+
154+
Requires:
155+
156+
- If ``order`` is specified, the set of distinct on
157+
properties must appear before the non-distinct on
158+
properties in ``order``.
153159
start_cursor (bytes):
154160
A starting point for the query results. Query cursors are
155161
returned in query result batches and `can only be used to
@@ -238,7 +244,7 @@ class AggregationQuery(proto.Message):
238244
"""
239245

240246
class Aggregation(proto.Message):
241-
r"""Defines a aggregation that produces a single result.
247+
r"""Defines an aggregation that produces a single result.
242248
243249
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
244250
@@ -261,7 +267,7 @@ class Aggregation(proto.Message):
261267
COUNT_UP_TO(1) AS count_up_to_1,
262268
COUNT_UP_TO(2),
263269
COUNT_UP_TO(3) AS count_up_to_3,
264-
COUNT_UP_TO(4)
270+
COUNT(*)
265271
OVER (
266272
...
267273
);
@@ -274,7 +280,7 @@ class Aggregation(proto.Message):
274280
COUNT_UP_TO(1) AS count_up_to_1,
275281
COUNT_UP_TO(2) AS property_1,
276282
COUNT_UP_TO(3) AS count_up_to_3,
277-
COUNT_UP_TO(4) AS property_2
283+
COUNT(*) AS property_2
278284
OVER (
279285
...
280286
);
@@ -298,7 +304,7 @@ class Count(proto.Message):
298304
entities to count.
299305
300306
This provides a way to set an upper bound on the number of
301-
entities to scan, limiting latency and cost.
307+
entities to scan, limiting latency, and cost.
302308
303309
Unspecified is interpreted as no bound.
304310

0 commit comments

Comments
 (0)
0