GeezerVison is showing github.com — Query should expose the value of `more_result` after query.fetch is called · Issue #423 · googleapis/google-cloud-python
Query should expose the value of more_result after query.fetch is called #423DescriptionA user that runs query.fetch(5) and gets 4 results will not know if they should call it again or if that is all the results. Activitydhermes commented on Dec 17, 2014 We're getting mixed signals on this.
We were told in #280 that more_results is broken in the API and it is noted in our code. This note was added in #287 and there is an accompanying discussion. tseaver commented on Dec 17, 2014 I don't believe it should be returned to the user: that kind of state belongs on the query instance (like the cursor value).
We could choose to save the more_results value on the query (along with the end_cursor), and expose it via a method or property, even though we know (for now) that the back-end borks it: after all, they might fix it in the future. silvolu commented on Dec 17, 2014 ContributorAuthor More actions Yeah, exposing sounds better. Fixing the title of the issue. changed the title [-]query.fetch should return the value of `more_result`[/-] [+]Query should expose the value of `more_result` after query.fetch is called[/+] on Dec 17, 2014dhermes commented on Dec 17, 2014 I don't think it belongs on the Query object. It is a result of a query, not a query itself (response, not request).
Two possible solutions that come to mind
- Create a separate method
fetch_page which returns more_results. (I prefer this)
- Add a flag to
fetch which allows a tuple of things to be returned instead of just the fetched entities.
tseaver commented on Dec 17, 2014 @dhermes We already store the cursor on the query; how is more_results different? dhermes commented on Dec 17, 2014 I'm saying we shouldn't be storing cursor on the query, I planned on changing this, so adding more_results would be piling on. tseaver commented on Dec 17, 2014 Where are you planning to track that state? In a cursor object returned by fetch? We could merge #425 and then move the two bits of state together. dhermes commented on Dec 17, 2014 The state should not be tracked, it should be returned and the user may use it as is.
Your plan of merge SGTM. Reviewing now. added a commit that references this issue on Dec 17, 2014This issue will close once commit 1b9f1c2 is merged into the 'main' branch.1b9f1c2 added a commit that references this issue on Mar 2, 2026This issue will close once commit c2cbf91 is merged into the 'main' branch.c2cbf91
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|