Umair Ejaz Umair Ejaz - 2 months ago 33
Python Question

Google App Engine: How to get data in query where column does not exist

Assume I have following query

MyModel.all().filter('transfered !=', True).fetch(limit = limit)

It will works fine where transferred column value will not be true in datastore. But in my collection there are some records which dont have a transferred column. How can I search those rows too from my collection?


I am afraid it's not possible. The indexes only store references to your entity where there is a value for the given property.

I suggest you do a couple of things.

  1. Reprocess the data to add some sort of sentinal value to all entities (possibly one of the valid values) that are missing the value. The sentinal value could be None, which is different to not having a value.

  2. Set a default value on the property that is something such as None, so that you can query for items that have no explicit value, if that makes sense in your application. This guards against the possibility of future entities having no value set.