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

Use of datetime.utcfromtimestamp() on 3.12+ is also deprecated #384

Open
slothkong opened this issue Apr 1, 2024 · 1 comment
Open

Use of datetime.utcfromtimestamp() on 3.12+ is also deprecated #384

slothkong opened this issue Apr 1, 2024 · 1 comment

Comments

@slothkong
Copy link

slothkong commented Apr 1, 2024

Hello there,

Although as of 1.7.0, deprecation of datetime.utcnow() was delt with by @RazerM ( 5273fa2 ), it seems like datetime.utcfromtimestamp() also requires some attention.

The official datetime docs point out:

Warning: Because naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing a specific timestamp in UTC is by calling datetime.fromtimestamp(timestamp, tz=timezone.utc).

For context, stumbled upon the deprecation warning while unittesting dbt-core, as part of issue 9791. When drilling down the logs, ended up at:

return datetime.utcfromtimestamp(timestamp)

@slothkong
Copy link
Author

I put up a tiny pull request to address the deprecation warnings, hopefully as part of the next minor release 🤞

Any feedback is more than welcomed~

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 a pull request may close this issue.

1 participant