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

Add-support-datetime-zone-info #111

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

RKN01011
Copy link
Collaborator

@RKN01011 RKN01011 commented Dec 3, 2024

Have added support for converting Python datetime objects with timezone information (tzinfo) to Rust types.

Motivation and Context
This change was required to address the issue where Python's datetime objects with tzinfo were raising the exception:
psqlpy.exceptions.PyToRustValueMappingError: Can't convert value from python to rust type: Can not convert your datetime to rust type.
The original issue:
#100

By implementing this fix, the functionality now properly handles datetime values with timezone information, bridging the type conversion gap between Python and Rust.

How has this been tested?
The changes were tested using tox as per the project's contributor guidelines. Existing tests in test_value_converter.py were rerun to verify the fix.

Additionally, a new test case was added to cover the scenario of converting a datetime.datetime object with timezone information (e.g., tzinfo=zoneinfo.ZoneInfo(key='Asia/Jakarta')). The test passed successfully, confirming the issue has been resolved without introducing regression.

Types of changes

x Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist

x My code follows the code style of this project.
My change requires a change to the documentation.
I have updated the documentation accordingly.

src/value_converter.rs Outdated Show resolved Hide resolved
Copy link
Member

@chandr-andr chandr-andr left a comment

Choose a reason for hiding this comment

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

LGTM!
Thank you very much!

@chandr-andr chandr-andr merged commit d578c0b into main Dec 10, 2024
10 checks passed
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.

2 participants