了解 GAE 中的 ListProperty 后端行为
我试图了解您应该如何访问 GAE db.ListProperty(db.Key) 中的项目。
示例:
Magazine
db.Model 实体有一个 db.ListProperty(db.Key),其中包含 10 个 Article
实体。我想获取杂志对象并显示文章名称和日期。我是否对实际的文章对象进行 10 次查询?我是否进行批量查询?如果有 50 篇文章怎么办? (不要批量查询依赖于 IN 运算符,元素数量限制为 30 个或更少?)
I'm trying to understand how you're supposed to access items in a GAE db.ListProperty(db.Key).
Example:
A Magazine
db.Model entity has a db.ListProperty(db.Key) that contains 10 Article
entities. I want to get the Magazine object and display the Article names and dates. Do I make 10 queries for the actual article objects? Do I do a batch query? What if there's 50 articles? (Don't batch queries rely on the IN operator, which is limited to 30 or fewer elements?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因此,您描述的是这样的内容:
在这种情况下,获取列出的文章的最简单方法是使用 Model.get() 方法,该方法查找关键列表。
根据您计划如何处理数据,您最好将杂志引用属性添加到您的文章实体中。
So you are describing something like this:
In this case the simplest way to grab the listed articles is to use the Model.get() method, which looks for a key list.
Depending on how you plan on working with the data you may be better off adding a Magazine reference property to your Article entities instead.
您需要阅读建模实体关系,尤其是一对多的部分。
You need to read Modeling Entity Relationships, especially the part about one to many.