Using the python version of GAE and extending models from db.Model, how do you fetch entities where an attribute equals None or does not exist?
#This works
#Fetch 10 entities where duration == 0.0
entities = MyModel.all().filter('duration = ', 0.0).fetch(10)
#This doesn't. How can I do the equivalent?
#Fetch 10 entities where duration == None
entities = MyModel.all().filter('duration = ', None).fetch(10)
You have entities without
durationproperty (can’t be filtered because index can’t refer to them) and entities withdurationset to None (can be filtered).Since you have changed
MyModelschema, you should fix the entities stored withoutdurationproperty with something like this:Have a look to appengine-mapreduce library to accomplish this long running task.