English 中文(简体)
A. 附录一
原标题:Querying for a value existing in a model s list property in AppEngine

样本模式:

  class Foo(db.Model):
     id = db.IntegerProperty()
     bar = db.ListProperty(int, required=True)
  1. 如何利用Query或Gql Query归还所有具有一定价值的实体<>bar?

  2. 如果我有一份女方名单,则有一个单一的过滤器,将收复所有有<>strong>id的实体。 财产被列入该清单?

最佳回答

1. 导言

如果您在一份清单中采用平等查询方法,它将检查清单上的所有物品:

search = 2
results = Foo.all().filter( bar = , search).fetch()

2. 结 论

您可以使用国家清单过滤器,但指出,在内部,该清单对清单中的每一项目都进行了数据储存查询,因此可能很缓慢,而且每次请求中最多还有30个内部查询。

items = [1, 2, 3]
results = Foo.all().filter("id IN", items).fetch()

See Introducing Queries for details for both 1 and 2, and

问题回答

对像我这样的人来说,他们无法得到上述工作答案。

采用1.05版

results = Foo.all().filter( bar = , search).fetch()

没有结果。 但

results = Foo.all().filter( bar = , search).fetch(100)
results = Foo.all().filter( bar = , search)

结果。





相关问题
How to make logging.debug work on Appengine?

I m having a tough time getting the logging on Appengine working. the statement import logging is flagged as an unrecognized import in my PyDev Appengine project. I suspected that this was just an ...

gqlQuery returns object, want list of keys

Is there a way to convert the GqlQuery object to an array of keys, or is there a way to force the query to return an array of keys? For example: items = db.GqlQuery("SELECT __key__ FROM Items") ...

Integrating Google AppEngine with a Thick Client

I want to make a multi-user client-server solution with Java Swing thick client as a front-end and Google AppEngine (Java one) as a back-end. The problem is that GAE provides only web-based forms for ...

sorl.thumbnail : thumbnail is not a valid tag library?

I am trying to install sorl.thumbnail but am getting the following error message: thumbnail is not a valid tag library: Could not load template library from django.templatetags.thumbnail, No module ...

热门标签