开发者

Using List in GQL Filter

开发者 https://www.devze.com 2023-03-18 17:27 出处:网络
How can I make a selection in GQL using a List as filter. I开发者_如何学JAVAf I have the class public class Obj{

How can I make a selection in GQL using a List as filter.

I开发者_如何学JAVAf I have the class

public class Obj{

    @Persistent
    private Long name;

}

How can I get all Obj's that the name are not in a list?


You can get the results by chain all filters together.

SELECT * FROM User where email != 'xxx@gmail.com' and email != 'yyy@gmail.com' and email != 'zzz@gmail.com'

Python Code

q = User.all()
for i in ilist:
    q = q.filter("email = ", i)

But you may need to know there are some limitations for this kind of query.

Note: The IN and != operators use multiple queries behind the scenes. For example, the IN operator executes a separate underlying datastore query for every item in the list. The entities returned are a result of the cross-product of all the underlying datastore queries and are de-duplicated. A maximum of 30 datastore queries are allowed for any single GQL query.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号