You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Saving datetime objects to Datastore - no documentation? #1200
Thanks for reporting this issue! What you've found is that we only accept actual datetime.datetime instances. The first example fails because time.gmtime() returns a time.struct_time instance; the second example returns a datetime.date.
The entity docs should describe the types of fields we support, and the constraints on them.
Activity
tseaver commentedon Oct 21, 2015
Thanks for reporting this issue! What you've found is that we only accept actual
datetime.datetimeinstances. The first example fails becausetime.gmtime()returns atime.struct_timeinstance; the second example returns adatetime.date.The entity docs should describe the types of fields we support, and the constraints on them.
igama commentedon Oct 21, 2015
I'm also looking in to this. For example,
Via http://console.developers.google.com the property appears as string.
thesandlord commentedon Oct 21, 2015
@tseaver yup it would be awesome if the docs / examples explained what types were accepted (string, bytes, int, float, datetime, etc).
@igama The issue is you are converting to a string with the strftime method call. If you remove that part it should save as a timestamp.
igama commentedon Oct 21, 2015
@thesandlord thanks, think I misread the documentation somewhere.
patitonav commentedon May 17, 2017
I found another related issue:
When i try:
Works fine, but affter when i look in the datastore dashboard i see 3 hours difference.
Any idea?
dhermes commentedon May 17, 2017
@patitonav You should use
datetime.datetime.utcnow()The underlying value is stored as a
Timestamp, whichWhen our code receives a "naive" timestamp (i.e. one without a timezone) it assumes the timestamp is UTC (via).
patitonav commentedon May 17, 2017
Yes. You were right thanks
lukesneeringer commentedon Aug 11, 2017
This seems resolved.
fix: updates _get_transitive_schema_fields and tests (#1200)
build(deps): bump certifi from 2022.9.24 to 2022.12.7 in /synthtool/g…
chore(deps): update all dependencies (#1200)
docs: migrate code from googleapis/python-bigquery (#18303)