views:

104

answers:

3

Dear All,

Let say I have a model:

class A(db.Model):
    B = db.StringProperty()
    C = db.StringProperty()

How do I query if I wanted to search all empty property (not None, just empty) in C using python?

A: 

Well if you want to return all rows with empty C properties you could do this.

empty = db.GqlQuery('SELECT * FROM A WHERE C = ""')

CoreyD
A: 

I wanted to know how to find empty property too but the

empty = db.GqlQuery('SELECT * FROM A WHERE C = ""')

simply not working

+3  A: 

From GAE Python documents

It is not possible to perform a query for entities that are missing a given property. One alternative is to create a fixed (modeled) property with a default value of None, then create a filter for entities with None as the property value.

Mattijle