使用Python中的Google App Engine中的实体键名进行过滤 [英] Filtering by entity key name in Google App Engine on Python
问题描述
在Google App Engine上用Python查询数据存储,可以使用GQL或Entity.all(),然后对其进行过滤。因此,例如这些是等价的
gql =SELECT * FROM用户WHERE年龄> = 18
db。 GqlQuery(gql)
和
<$ p $ ($ age $ gt; $ 18)
$ / code>
现在,也可以通过键名查询事物。我知道在GQL中你是这样做的 但是,您会如何现在使用过滤器来做同样的事情? On Google App Engine to query the data store with Python, one can use GQL or Entity.all() and then filter it. So for example these are equivalent and Now, it's also possible to query things by key name. I know that in GQL you do it like this But how would you now use filter to do the same?
这篇关于使用Python中的Google App Engine中的实体键名进行过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! query = User.all()
query.filter
gql =SELECT * FROM User WHERE __key__> = Key('User ','abc')
db.GqlQuery(gql)
query = User.all()
query.filter(__ key__> ; =,?????)
from google.appengine.api.datastore import key
query.filter(__ key__> =,Key.from_path('User','abc'))
gql = "SELECT * FROM User WHERE age >= 18"
db.GqlQuery(gql)
query = User.all()
query.filter("age >=", 18)
gql = "SELECT * FROM User WHERE __key__ >= Key('User', 'abc')"
db.GqlQuery(gql)
query = User.all()
query.filter("__key__ >=", ?????)
from google.appengine.api.datastore import Key
query.filter("__key__ >=", Key.from_path('User', 'abc'))