Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions gcloud/datastore/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,14 @@ def run_query(self, dataset_id, query_pb, namespace=None):
Using the `fetch`` method...

>>> query.fetch()
[<list of Entity Protobufs>], cursor, more_results, skipped_results
[<list of Entity unmarshalled from protobuf>]
>>> query.cursor()
<string containing cursor where fetch stopped>

Under the hood this is doing...

>>> connection.run_query('dataset-id', query.to_protobuf())
[<list of Entity Protobufs>]
[<list of Entity Protobufs>], cursor, more_results, skipped_results

:type dataset_id: string
:param dataset_id: The ID of the dataset over which to run the query.
Expand Down
7 changes: 7 additions & 0 deletions gcloud/datastore/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,13 @@ def fetch(self, limit=None):
dataset_id=self.dataset().id(),
namespace=self._namespace,
)
# NOTE: `query_results` contains two extra values that we don't use,
# namely `more_results` and `skipped_results`. The value of
# `more_results` is unusable because it always returns an enum
# value of MORE_RESULTS_AFTER_LIMIT even if there are no more
# results. See
# https://github.com/GoogleCloudPlatform/gcloud-python/issues/280
# for discussion.
entity_pbs, end_cursor = query_results[:2]

self._cursor = end_cursor
Expand Down