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

utcnow() Deprecation Warning #997

Open
pierre-phntm opened this issue Jul 18, 2024 · 0 comments
Open

utcnow() Deprecation Warning #997

pierre-phntm opened this issue Jul 18, 2024 · 0 comments
Assignees
Labels
api: datastore Issues related to the googleapis/python-ndb API.

Comments

@pierre-phntm
Copy link

_now staticmethod, used by auto_now_add, is using datetime.datetime.utcnow(), which is deprecated.

Environment details

  1. API: python-ndb
  2. 2020 MacOSX; Sonama 14.5
  3. Python 3.12.4
  4. google-cloud-ndb version: 2.16.0

Steps to reproduce

  1. Add auto_now_add to a DateTimeProperty model.

Code example

time_stamp_field = ndb.DateTimeProperty(tzinfo=datetime.timezone.utc, auto_now_add=True)

Stack trace

DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
@product-auto-label product-auto-label bot added the api: datastore Issues related to the googleapis/python-ndb API. label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/python-ndb API.
Projects
None yet
Development

No branches or pull requests

2 participants