Skip to content

feat: Add time_zone to Datetime results #33

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

dfrankland
Copy link

@dfrankland dfrankland commented May 7, 2025

Motivation

Closes #32

Changes

allows setting a time zone for datetimes and checking if the values in the column matches it

Pertinent polars docs:
https://docs.pola.rs/user-guide/transformations/time-series/timezones/

allows setting a time zone for datetimes and checking if the values in the column matches it
@dfrankland dfrankland changed the title add time_zone to Datetime results feat: add time_zone to Datetime results May 7, 2025
@github-actions github-actions bot added the enhancement New feature or request label May 7, 2025
Copy link

codecov bot commented May 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (6c955c4) to head (bf6ac85).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #33   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           38        38           
  Lines         1845      1850    +5     
=========================================
+ Hits          1845      1850    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@AndreasAlbertQC AndreasAlbertQC left a comment

Choose a reason for hiding this comment

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

Thanks for the nice PR @dfrankland! Could you add a test in test_sql_schema.py for the oracle part?

@dfrankland dfrankland requested a review from AndreasAlbertQC May 9, 2025 21:46
Copy link
Member

@borchero borchero left a comment

Choose a reason for hiding this comment

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

Thanks for the initiative @dfrankland, I think this is a very useful addition! :)

@borchero borchero changed the title feat: add time_zone to Datetime results feat: Add time_zone to Datetime results May 9, 2025
@dfrankland
Copy link
Author

Let me know if you'd like for me to rebase these changes

@dfrankland dfrankland requested a review from borchero May 9, 2025 23:56
@dfrankland dfrankland force-pushed the add-time_zone-to-datetime-results branch from 8de8c8f to 30e3538 Compare May 10, 2025 00:28
Copy link
Member

@borchero borchero left a comment

Choose a reason for hiding this comment

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

All right, nice, I think we're almost there! :)

@dfrankland
Copy link
Author

Updated to keep things minimal and also made the test name more accurate

@dfrankland dfrankland requested a review from borchero May 12, 2025 14:45
Copy link
Member

@borchero borchero left a comment

Choose a reason for hiding this comment

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

Thank you for the updates! Just one tiny comment left :)

return pa.timestamp("us")
time_zone = (
self.time_zone.tzname(None)
if isinstance(self.time_zone, dt.timezone)
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this mirror the type annotation? 😄

Suggested change
if isinstance(self.time_zone, dt.timezone)
if isinstance(self.time_zone, dt.tzinfo)

Comment on lines +12 to +17
from dataframely._compat import (
pa,
sa,
sa_mssql,
sa_TypeEngine,
)
Copy link
Member

Choose a reason for hiding this comment

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

Nothing changed here, right?

Suggested change
from dataframely._compat import (
pa,
sa,
sa_mssql,
sa_TypeEngine,
)
from dataframely._compat import pa, sa, sa_mssql, sa_TypeEngine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dy.Datetime() does not support time_unit and time_zone
3 participants