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

bugfix infinite pagination in CDK #3366

Merged
merged 7 commits into from
May 11, 2021
Merged

bugfix infinite pagination in CDK #3366

merged 7 commits into from
May 11, 2021

Conversation

sherifnada
Copy link
Contributor

What

Closes #3363

How

The CDK incorrectly set next_page_token to None at the beginning of every pagination loop iteration. Fix this by not setting next_page_token inside the loop.

@sherifnada sherifnada requested review from yevhenii-ldv, keu and davinchia and removed request for michel-tricot and masonwheeler May 11, 2021 18:57
@sherifnada sherifnada mentioned this pull request May 11, 2021
@@ -21,7 +21,7 @@ class AirbytePythonPlugin implements Plugin<Project> {
installVirtualenv = true
pip 'flake8:3.8.4'
pip 'black:20.8b1'
pip 'mypy:0.790'
pip 'mypy:0.812'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump gradle mypy to latest version so running something like gradle format doesn't overwrite with an older mypy version

def test_stub_next_page_token_http_stream_read_records(mocker):

stream = StubNextPageTokenHttpStream()
def test_pagination(mocker):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have a more expressive name?

getattr(stream, method).assert_any_call(next_page_token=None, stream_slice=None, stream_state={}) # Assert first call happened
for token in expected_next_page_tokens:
getattr(stream, method).assert_any_call(next_page_token=token, stream_slice=None, stream_state={})

assert [{"data": 1}, {"data": 2}, {"data": 3}, {"data": 4}, {"data": 5}, {"data": 6}] == records
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or at least get message here why we expect these data and better move expected to separate variable

@sherifnada
Copy link
Contributor Author

sherifnada commented May 11, 2021

/publish-cdk dry-run=false

🕑 https://github.com/airbytehq/airbyte/actions/runs/833227648
https://github.com/airbytehq/airbyte/actions/runs/833227648

@sherifnada sherifnada merged commit 535d83e into master May 11, 2021
@sherifnada sherifnada deleted the sherif/cdk-bugfix-npt branch May 11, 2021 21:45
Copy link
Contributor

@keu keu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sherifnada sherifnada added this to the Core - 2021-05-14 milestone May 17, 2021
@sherifnada sherifnada self-assigned this May 17, 2021
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.

Stripe source: Endless stream reading.
3 participants