Skip to content

Conversation

@georgesittas
Copy link

@georgesittas georgesittas commented Oct 17, 2024

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

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Local run of ./build.sh succeeds
  • Code changes have been run against the repository's pre-commit hooks
  • Commit messages follow Conventional Commit Specification
  • I have read the README document
  • I have added tests to cover my changes
  • I have run all unit tests using pytest test/unit and 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.

…n as is

Previously, the Cursor.fetch_dataframe method lowercased column names preemptively,
thus not respecting the active case-sensitivity configuration value. This could lead
to issues, when e.g. two different columns resolved to the same name when lowercased.

This commit ensures the resulting DataFrame's columns are the same as the ones in the
cursor's description, thus reflecting Redshift's behavior and respecting the underlying
case-sensitivity configuration.
@georgesittas
Copy link
Author

georgesittas commented Feb 26, 2025

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!

@georgesittas
Copy link
Author

Hey folks, @iggarish @timm4205, is this something you can help review? Thanks!

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.

The Cursor.fetch_dataframe method doesn't respect case-sensitivity

1 participant