views:

289

answers:

1

On Google App Engine to query the data store with Python, one can use GQL or Entity.all() and then filter it. So for example these are equivalent

gql = "SELECT * FROM User WHERE age >= 18"
db.GqlQuery(gql)

and

query = User.all()
query.filter("age >=", 18)

Now, it's also possible to query things by key name. I know that in GQL you do it like this

gql = "SELECT * FROM User WHERE __key__ >= Key('User', 'abc')"
db.GqlQuery(gql)

But how would you now use filter to do the same?

query = User.all()
query.filter("__key__ >=", ?????)
+4  A: 
from google.appengine.api.datastore import Key
query.filter("__key__ >=", Key.from_path('User', 'abc'))
Bemmu