amazon-redshift-python-driver
amazon-redshift-python-driver copied to clipboard
Fix: force timeouts to integer types
Description
literally just 2 int() casts for various cases where timeout and idp_response_timeout are read in as strings, but should be integers
Motivation and Context
Since sqlalchemy (and other packages) force url parameters to be passed as strings to redshift_connector, we can run into basic and avoidable issues from this package when connecting to Redshift via SQLAlchemy via the BrowserAzureOAuth2CredentialsProvider method.
Testing
Built package, connected, fixed the bug.
Screenshots (if appropriate)
code to reproduce:
from sqlalchemy import create_engine
engine = create_engine(
"redshift+redshift_connector://{HOST}:5439/{DATABASE}credentials_provider=BrowserAzureOAuth2CredentialsProvider&client_id={CLIENT}&idp_tenant={IDP_TENANT}&scope={SCOPE}/jdbc_login&idp_response_timeout=500&timeout=900000"
)
with engine.connect() as conn:
result = conn.execute("SELECT 1")
print(result.fetchone())
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
Checklist
- [x] Local run of
./build.shsucceeds - [ ] Code changes have been run against the repository's pre-commit hooks
- [x] Commit messages follow Conventional Commit Specification
- [x] I have read the README document
- [ ] I have added tests to cover my changes
- [x] I have run all unit tests using
pytest test/unitand they are passing.
- By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
@Brooke-white not sure what the best way to request review on this is.