从多对多关系检索数据的 GQL/替代方案
我还没有找到关于如何使用 GQL 或任何替代方案查询多对多关系模型的良好简单教程。谁能给我一个使用 GQL 或任何替代方案的 Python 示例?
编辑:
results = RestaurantReview.all().filter("Restaurant = %s", restaurant_key).filter("User = %s", user[0].key().__str__()).fetch()
以下错误日志反映了上述陈述:
'NoneType' object has no attribute 'group':
这与数据库列表属性有关吗?如果是这样,你能举个例子吗?
I haven't been able to find a good simple tutorial on how to query many to many relationship model using GQL or any alternative. Can anyone give me an example with Python using GQL or any alternative?
EDIT:
results = RestaurantReview.all().filter("Restaurant = %s", restaurant_key).filter("User = %s", user[0].key().__str__()).fetch()
The error log of following reflects above statement:
'NoneType' object has no attribute 'group':
Is this related to DB List Property? If so, can you give example on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ManyToManyModel.all().filter("model1 =", model1_key).filter("model2 =", model2_key).fetch()
ManyToManyModel 是一个具有两个属性的模型,都是引用属性,
模型1
和模型2
。model1_key
和model2_key
都是各自字段的单个键。如需更深入的信息,请参阅文档中的这篇有用的文章。ManyToManyModel.all().filter("model1 =", model1_key).filter("model2 =", model2_key).fetch()
ManyToManyModel is a model with two properties, both reference properties,
model1
andmodel2
.model1_key
andmodel2_key
are each a single key for their respective fields. For more in-depth information, see this helpful article in the documentation.