Skip to content

Commit 8bad0d7

Browse files
committed
Documenting the fact the more_results is unfit for use in datastore.
1 parent 2da8654 commit 8bad0d7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

gcloud/datastore/connection.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,14 @@ def run_query(self, dataset_id, query_pb, namespace=None):
217217
Using the `fetch`` method...
218218
219219
>>> query.fetch()
220-
[<list of Entity Protobufs>], cursor, more_results, skipped_results
220+
[<list of Entity unmarshalled from protobuf>]
221+
>>> query.cursor()
222+
<string containing cursor where fetch stopped>
221223
222224
Under the hood this is doing...
223225
224226
>>> connection.run_query('dataset-id', query.to_protobuf())
225-
[<list of Entity Protobufs>]
227+
[<list of Entity Protobufs>], cursor, more_results, skipped_results
226228
227229
:type dataset_id: string
228230
:param dataset_id: The ID of the dataset over which to run the query.

gcloud/datastore/query.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,13 @@ def fetch(self, limit=None):
333333
dataset_id=self.dataset().id(),
334334
namespace=self._namespace,
335335
)
336+
# NOTE: `query_results` contains two extra values that we don't use,
337+
# namely `more_results` and `skipped_results`. The value of
338+
# `more_results` is unusable because it always returns an enum
339+
# value of MORE_RESULTS_AFTER_LIMIT even if there are no more
340+
# results. See
341+
# https://github.com/GoogleCloudPlatform/gcloud-python/issues/280
342+
# for discussion.
336343
entity_pbs, end_cursor = query_results[:2]
337344

338345
self._cursor = end_cursor

0 commit comments

Comments
 (0)