Skip to content
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

Add new DB methods for iterating over paginated results #665

Merged
merged 7 commits into from
Nov 14, 2020

Conversation

Mr0grog
Copy link
Member

@Mr0grog Mr0grog commented Nov 13, 2020

This adds a new set of get_*() methods to replace list_*() in db.Client. For example, get_pages() replaces list_pages().

These new methods return an iterator over the entire result set rather than a single, paginated chunk of results. They make for much nicer usage and should make #664 easier.

The old methods will eventually be removed; they’re not what you want 99% of the time, and when you do need them, you can still call client.request_json(). It’s slightly more verbose, but that’s OK for the uncommon use case.

Fixes #660.

Instead of `list_pages()`, you should now use `get_pages()`, which returns an iterator over all the results (instead of returning a single chunk). This is the API we want 99% of the time, and for more complex use cases, you can always call `request_json(method, path, **kwargs)`.

Fixes #660.
@Mr0grog Mr0grog force-pushed the 660-that-iterable-api-weve-needed-forever branch from 4263676 to 2345166 Compare November 14, 2020 02:00
@Mr0grog Mr0grog merged commit eb62913 into main Nov 14, 2020
@Mr0grog Mr0grog deleted the 660-that-iterable-api-weve-needed-forever branch November 14, 2020 02:13
Mr0grog added a commit that referenced this pull request Dec 2, 2020
Includes:
#653
#654
#656
#657
#658
#662
#666
#665
#668
#667
#678
and December dependency updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DB API needs methods for iterating over paginated results
1 participant