问题
Say I've got an entity with a StringListProperty: 'ids' - a list of ids associated with the entity. I then want to query for that entity by asking if a given id is in ids.
I know you can use filter
q.filter("last_name IN", list)
but I need the reverse, something like:
q.filter('id' IN ids)??
or
q = db.GqlQuery("SELECT * FROM entity WHERE :1 IN ids", id)
https://developers.google.com/appengine/docs/python/datastore/queries
回答1:
It's just q.filter('ids', id)
.
来源:https://stackoverflow.com/questions/11328412/gae-gql-get-entity-if-list-contains-item