GQLQuery with_cursor 不起作用
想知道是否有人知道为什么在 GQLQuery 中使用游标似乎无法正常工作。
我正在运行以下内容。
query = "SELECT * FROM myTable WHERE accountId = 'agdwMnBtZXNochALEglTTkFjY291bnQYpQEM' and lastUpdated > DATETIME('0001-01-01 00:00:00') ORDER BY lastUpdated ASC LIMIT 100"
if lastCursor:
dataLookup = GqlQuery(query).with_cursor(lastCursor)
else
dataLookup = GqlQuery(query)
//dataLookup.count() here returns some value like 350
for dataItem in dataLookup:
... do processing ...
myCursor = dataLookup.cursor()
dataLookup2 = GqlQuery(query).with_cursor(myCursor)
//dataLookup2.count() now returns 0, even though previously it indicates many more batches can be returned
感谢您的帮助。
wondering if anyone knows why using cursors with GQLQuery doesn't seem to be working properly.
I'm running the following.
query = "SELECT * FROM myTable WHERE accountId = 'agdwMnBtZXNochALEglTTkFjY291bnQYpQEM' and lastUpdated > DATETIME('0001-01-01 00:00:00') ORDER BY lastUpdated ASC LIMIT 100"
if lastCursor:
dataLookup = GqlQuery(query).with_cursor(lastCursor)
else
dataLookup = GqlQuery(query)
//dataLookup.count() here returns some value like 350
for dataItem in dataLookup:
... do processing ...
myCursor = dataLookup.cursor()
dataLookup2 = GqlQuery(query).with_cursor(myCursor)
//dataLookup2.count() now returns 0, even though previously it indicates many more batches can be returned
Thanks for all your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不应该在查询中使用 LIMIT,因为这只会返回前 100 个结果,我假设您需要所有结果,但每次会以 100 个为一批进行处理。
这是我要做的(基于您的示例代码):
You should not use a LIMIT in your query, as that will only return the first 100 results, and I assume you want all of them, but process them in batches of 100 each time.
Here's what I would do (based on your example code):