-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/cursor paging #51
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
8a8bc0f
first pass at adding cursor paging
de1e246
draft
34084ba
first draft at parallel partitioning
19929f1
code clean up
8c70514
move partitioning logic
411628f
change default
8f4b98e
add condition to skip first fetch when partitioning
a2dfb6c
flatten final return list
01d36fd
revert default paging method
c9f6397
add docs
ef7282d
add check for endpoint type since cursor paging does not support dele…
cf0b236
remove partitioning for now
a495ec0
decouple and refactor get_pages() into 2 smaller pagination generators
36157dc
default to cursor paging for `get_rows()`
2f0050d
fall back on reverse-offset if ods version not compatible with cursor…
68401f2
fall back on reverse-offset if incompatible with cursor paging
b3b708c
remove default step_change_version arg
d622074
undo get()
749cfc0
remove unneeded code
8672da0
move fallbacks to `get_rows()`
db06877
debug
493f998
reverse-offset as default
776c3ba
code clean up
b1a83ec
Minor cleanup of whitespace and logging.
jayckaiser aca665f
Implement get_pages instead of get_pages_cursor in composites.
jayckaiser 1376c31
Label composite-offset pagination scheme with correct method.
jayckaiser f2efff8
Merge branch 'main' into feature/cursor_paging
jayckaiser 75c42b9
Use defined logger in EdFiEndpoint instead of default.
jayckaiser 76052ab
Minor cleanup.
jayckaiser 8762b2c
Merge branch 'feature/cursor_paging' of https://github.com/edanalytic…
e6b684e
remove attribute
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,8 @@ def __init__(self, | |
| # These parameters are only used during pagination. They must be explicitly initialized. | ||
| self.page_size = None | ||
| self.change_version_step_size = None | ||
| self.page_token = None | ||
| self.number = None | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this |
||
|
|
||
|
|
||
| def copy(self) -> 'EdFiParams': | ||
|
|
@@ -190,3 +192,36 @@ def reverse_page_by_offset(self): | |
|
|
||
| if self['offset'] < 0: | ||
| raise StopIteration | ||
|
|
||
| def init_page_by_token(self, page_token: str, page_size: int): | ||
|
gnguyen87 marked this conversation as resolved.
Outdated
|
||
| """ | ||
|
|
||
| :param page_size: | ||
| :param page_token: | ||
| :return: | ||
| """ | ||
|
|
||
| # Cursor paging behavior: page_token is required when page_size is specified. | ||
| # - If page_token is None: first request, do NOT include page_size | ||
| # - If page_token is present: include page_token and page_size | ||
| self.page_size = page_size | ||
| self.page_token = page_token | ||
|
|
||
| if page_token is None: | ||
| self.pop("pageToken", None) | ||
| self.pop("pageSize", None) | ||
| else: | ||
| self["page_token"] = self.page_token | ||
| self["page_size"] = self.page_size | ||
|
|
||
| def init_page_by_partitions(self, number: int): | ||
| """ | ||
|
|
||
| :param number: | ||
| :return: | ||
| """ | ||
|
|
||
| self.number = number | ||
| self["number"] = number | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.