Ok so I have the same python code locally and in the gae cloud.
when I store an entity locally, the ListProperty field of set element type datetime.datetime looks like so in the Datastore Viewer:
2009-01-01 00:00:00,2010-03-10 00:00:00
when I store same on the cloud, the viewer displays:
[datetime.datetime(2009, 1, 1, 0, 0), datetime.datetime(2010, 3, 9, 0, 0)]
why the different representation?
This wouldn't bother me, only when I query on this field on the cloud the query fails to find the matched entity (it should and it does locally) - leading me to believe it's this differing representation that is causing the trouble. I should repeat - the code is identical.
Anyone think of a reason why this is happening and a solution to it?
UPDATE: my query is as follows (using filters):
from x import y
from datetime import datetime
from google.appengine.ext import db
q = y.EntityType.all().filter('displayDateRange <=',datetime.now()).filter('displayDateRange >=',datetime.now())
usersResult = q.fetch(100)
print `len(usersResult)`
result should be 1, instead it's 0.
Actually it's just the ListProperty with specified value datetime.datetime that is the issue - queries on the StringListProperty is working as expected on the cloud.
I tried the raw filter via interactive console on both local and cloud and cloud gives me no results. So it is a datastore thing, I'm assuming it must have something to do with the storage format - I only have one entity value in both datastores with the ListProperty looking like:
2009-01-01 00:00:00,2010-03-09 00:00:00
[datetime.datetime(2009, 1, 1, 0, 0), datetime.datetime(2010, 3, 9, 0, 0)]
on local and cloud respectively.
Any ideas?
Further Update
Replaced the datetime.now() with hardcoded datetime obj - example filter now looks like:
y.EntityType.all().filter('displayDateRange <=',datetime(2009,11,24)).filter('displayDateRange >=',datetime(2009,11,24))
Note with the above datetime ListProperty range from 1.1.2009 to 3.9.2010 this should return the above entity - I tried this identical filter on localhost dev server and it did so. The cloud, with it's different representation of the datetime.datetime ListProperty, does not.
Note this is taken from the current best practice for filtering on date range
Any ideas what could be wrong?