1
如何在GQL中编写以下查询? [1]Gql query for repeated StructuredProperty
Contact.query(Contact.address == Address(city='San Francisco',
street='Spear St'))
[1] Filtering for Structured Property Values
如何在GQL中编写以下查询? [1]Gql query for repeated StructuredProperty
Contact.query(Contact.address == Address(city='San Francisco',
street='Spear St'))
[1] Filtering for Structured Property Values
引用https://cloud.google.com/appengine/docs/python/ndb/queries#gql, “查询包含结构化的属性,可以使用foo.bar
在GQL语法来引用子属性模型” - 所以,如果我理解正确你的任务,
'''SELECT * FROM Contact
WHERE address.city='San Francisco' AND
address.street='Spear St'
'''
应该工作。不是吗?
不,它没有。查询是一样的: 'Contact.query(!Contact.address.city == '阿姆斯特丹',#谨防 Contact.address.street == '矛圣')' >可以找到联系人一个地址的城市是'阿姆斯特丹',另一个(不同的)地址的街道是'Spear St'。 – webo 2015-01-21 04:17:52
查看源代码https://cloud.google.com/appengine/docs/python/refdocs/modules/google/appengine/ext/ndb/query#RepeatedStructuredPropertyPredicate我不认为数据库直接支持您所查询的内容试图去做。我认为NDB库正在做类似于上面的事情,然后验证正确的属性在“内存”(在应用程序层)中具有正确的值。 – natb1 2016-03-02 14:07:44