Filtering by entity key name in Google App Engine on Python

Posted by Bemmu on Stack Overflow See other posts from Stack Overflow or by Bemmu
Published on 2010-03-30T10:57:29Z Indexed on 2010/03/30 11:03 UTC
Read the original article Hit count: 452

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__ >=", ?????)

© Stack Overflow or respective owner

Related posts about google-app-engine

Related posts about python