Skip to content

Make backwards compatible with urllib3~=1.0 [Follow up #197] #206

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 3 commits into from
Aug 24, 2023
Merged

Conversation

susodapop
Copy link
Contributor

Description

Not sure how we missed this when testing #197, but urllib3~=1.x does not implement backoff_max or backoff_jitter configurations. So executions would fail for users who installed urllib31=1.x. This PR completes the work of #197 and updates our retry test mocks to be compatible with the internal workings of the older urllib3 version.

urllib3 version 1 expects the response to include a .msg attribute with .keys() and .items() methods. While in real-life execution this would be an HTTPMessage object, the dict() that our mocks use for headers is already sufficient and implements those methods. .msg is ignored in urllib3 version 2 so the same mock definition works regardless of which version of urllib3 is installed.

Going forward, we should have some kind of smoke test that runs our tests with both versions of urllib3 installed. A bare install of this connector always pulls urllib3 version 2, but many customers and partners will have already installed an older urllib3 -- this case isn't captured in our current testing pattern.

Related Tickets & Documents

Resolves #205
Resolves ES-836977

@susodapop
Copy link
Contributor Author

The python 3.7 checks are failing because our poetry github action fails with no details. Investigating.

Jesse Whitehouse added 3 commits August 24, 2023 11:49
We already implement the equivalent of backoff_max so the behaviour will
be the same for urllib3==1.x and urllib3==2.x

We do not implement backoff jitter so the behaviour for urllib3==1.x will
NOT include backoff jitter whereas urllib3==2.x WILL include jitter.

Signed-off-by: Jesse Whitehouse <[email protected]>
Signed-off-by: Jesse Whitehouse <[email protected]>
@susodapop
Copy link
Contributor Author

Fixed the actions failure in #208. Rebased onto main to incorporate that fix and updated the changelog release date.

@susodapop
Copy link
Contributor Author

Checks all pass now 🚀

@susodapop susodapop merged commit a918f13 into main Aug 24, 2023
@susodapop susodapop deleted the 836977 branch August 24, 2023 15:54
susodapop pushed a commit to unj1m/databricks-sql-python that referenced this pull request Sep 19, 2023
databricks#206)

* Make retry policy backwards compatible with urllib3~=1.0.0

We already implement the equivalent of backoff_max so the behaviour will
be the same for urllib3==1.x and urllib3==2.x

We do not implement backoff jitter so the behaviour for urllib3==1.x will
NOT include backoff jitter whereas urllib3==2.x WILL include jitter.

---------

Signed-off-by: Jesse Whitehouse <[email protected]>
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.

Unexpected argument backoff_max with databricks-sql-connector 2.9.2
2 participants