Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
Migrate datastore iterator to use base iterator class#2706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
d0abce801e333fa4af15a79dca14f7226370f1ee5396fc53bf2b828ea3f68a4845efc9eec6e9faaaa1007a97e00File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -456,19 +456,30 @@ def query(self, **kwargs): | ||
| >>> query = client.query(kind='MyKind') | ||
| >>> query.add_filter('property', '=', 'val') | ||
| Using the query iterator's | ||
| :meth:`~google.cloud.datastore.query.Iterator.next_page` method: | ||
| Using the query iterator | ||
| .. code-block:: python | ||
| >>> query_iter = query.fetch() | ||
| >>> entities, more_results, cursor = query_iter.next_page() | ||
| >>> entities | ||
| [<list of Entity unmarshalled from protobuf>] | ||
| >>> more_results | ||
| <boolean of more results> | ||
| >>> cursor | ||
| <string containing cursor where fetch stopped> | ||
| >>> for entity in query_iter: | ||
| ... do_something(entity) | ||
| or manually page through results | ||
| .. code-block:: python | ||
| >>> query_iter = query.fetch(start_cursor='2mdd223i944') | ||
| >>> pages = query_iter.pages | ||
| >>> | ||
| >>> first_page = next(pages) | ||
| >>> first_page_entities = list(first_page) | ||
| >>> query_iter.next_page_token | ||
| 'abc-some-cursor' | ||
| >>> | ||
| >>> second_page = next(pages) | ||
| >>> second_page_entities = list(second_page) | ||
| >>> query_iter.next_page_token is None | ||
| True | ||
| Under the hood this is doing: | ||
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page.
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page. | ||
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.