waigani
waigani

Reputation: 3580

GAE GQL - get entity if list contains item

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

Upvotes: 0

Views: 1216

Answers (1)

Gwyn Howell
Gwyn Howell

Reputation: 5424

It's just q.filter('ids', id).

Upvotes: 1

Related Questions