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