GAE GQL - get entity if list contains item

浪子不回头ぞ 提交于 2019-12-25 05:22:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!