与某个日期范围内的 Google App Engine 查询相关的问题
我担心以这种方式查询实体
created_start = datetime.today()
created_start = created_start - timedelta(hours=1)
created_end = datetime.now()
a = Message.all()
a.filter('created >=',created_start)
a.filter('created <',created_end)
由于 1000 个查询结果限制, 。那么两个问题:
- 如果
.all()
返回超过 1000 个结果,这会起作用吗?或者换一种说法。如果有更多结果,all()
是否会返回超过 1000 个结果? - 有没有更好的方法来实现给定数据范围之间实体的查询?
预先非常感谢
I am concerned about querying entities this way
created_start = datetime.today()
created_start = created_start - timedelta(hours=1)
created_end = datetime.now()
a = Message.all()
a.filter('created >=',created_start)
a.filter('created <',created_end)
Due to the 1000 query results restriction. So two questions:
- Will this work if
.all()
returns more that 1000 results? Or to put it in a different way. Willall()
return more than a 1000 results incase there were more? - Is there a better way to achieve querying for entities between a given data range?
Thank you very much in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的解决方案很好,因为版本 1.3.6,查询结果不再上限为 1000。
您可以迭代
a
实体直至耗尽,或使用 光标。Your solution is good, since Version 1.3.6, query results are no longer capped at 1000.
You can iterate
a
entities until exhaustion or fetch chunks of entities using a cursor.