您能否在Appengine中获得模型的所有实体,而不是gqlquery? [英] Can you get all entities of a model in appengine and not a gqlquery
本文介绍了您能否在Appengine中获得模型的所有实体,而不是gqlquery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要我所有模型实体的列表. Model.all()返回一个gqlquery.我知道我可以在查询中进行列表理解,并得到所需的结果.有没有一种内置的方法可以节省进行理解的额外步骤?
I want a list of all my model entities. Model.all() returns a gqlquery. I know that I can then do list comprehension on the query and end up with the result I am seeking. Is there not a way already built-in saving the additional step of doing the comprehension?
还是每个人都只是自己继承并构建方法? ...还是这是一种安全措施,阻止我们访问比我们预期要承担更多费用的数据?
Or is everyone just subclassing and building the method in themselves? ... or is this a safety measure preventing us from accessing more data then we intended incurring costs?
谢谢
推荐答案
您有2个选择:
- 使用fetch()并获取定义数量的实体,例如Model.all().fetch(100)
- 使用Model.all()并遍历查询.
这篇关于您能否在Appengine中获得模型的所有实体,而不是gqlquery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文