views:

137

answers:

1

In GAE, I have a model called Foo, with existing entities, and attempt to add a new property called memcached to Foo that takes datetime values for the last time this value was set to memcache. If I try to query and sort on this property, or even filter for entities that do not have a value for memcached, entities that haven't had a value set for this property yet are not returned. Is there something I'm missing here, or as an alternative, is there a quick way to set a value for a new property on every entity of a given model?

I have created a bunch of entities of the following model,

class Foo(db.Model):
    name = db.StringProperty(required=True)

and then add a property to this model,

class Foo(db.Model):
    name = db.StringProperty(required=True)
    memcached = db.DateTimeProperty(required=True, auto_now=True, auto_now_add=True, default=datetime.min)

the default value of the new property is not considered when I do a sort or filter on a query.

+4  A: 

There's nothing for it but to go through each of your existing entities and add the property, here is the official documentation which walks you through the process.

robertc