From 8bad0d781904c49a71ace09d8d4a393525bd4fe5 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Thu, 23 Oct 2014 09:48:49 -0700 Subject: [PATCH] Documenting the fact the more_results is unfit for use in datastore. --- gcloud/datastore/connection.py | 6 ++++-- gcloud/datastore/query.py | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcloud/datastore/connection.py b/gcloud/datastore/connection.py index aff322d90926..410cf8e534a2 100644 --- a/gcloud/datastore/connection.py +++ b/gcloud/datastore/connection.py @@ -217,12 +217,14 @@ def run_query(self, dataset_id, query_pb, namespace=None): Using the `fetch`` method... >>> query.fetch() - [], cursor, more_results, skipped_results + [] + >>> query.cursor() + Under the hood this is doing... >>> connection.run_query('dataset-id', query.to_protobuf()) - [] + [], cursor, more_results, skipped_results :type dataset_id: string :param dataset_id: The ID of the dataset over which to run the query. diff --git a/gcloud/datastore/query.py b/gcloud/datastore/query.py index b556e380b3bd..b8ca58b7c483 100644 --- a/gcloud/datastore/query.py +++ b/gcloud/datastore/query.py @@ -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