fix(cursor, fetch_dataframe): use column names in cursor's description as is
Previously, the Cursor.fetch_dataframe method lowercased column names preemptively, thus not respecting the case-sensitivity configuration value. This could lead to issues, when e.g. two different columns resolved to the same name when lowercased.
This PR fixes the issue by ensuring the resulting DataFrame's columns are the same as the ones in the cursor's description attribute, thus making the driver match Redshift's behavior.
Motivation and Context
Fixes #238
Testing
Implemented a unit test that demonstrates how fetch_dataframe preserves the column names as they appear in the cursor's description attribute.
After making the change, I ran python -m pytest test/unit in a fresh environment and observed all tests succeeding:
922 passed, 11 warnings in 3.26s
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
Checklist
- [x] Local run of
./build.shsucceeds - [x] 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
- [x] I have added tests to cover my changes
- [x] I have run all unit tests using
pytest test/unitand they are passing.
License
- By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Hey @Brooke-white 👋
Just wondering if there are any updates here. Let me know if there's anything I can help with to get this PR reviewed.
EDIT: I just saw that you're no longer working at AWS Redshift, apologies! Could you point me to someone that I could reach out to for this? Thanks!
Hey folks, @iggarish @timm4205, is this something you can help review? Thanks!