1
votes

In documentation for Query class https://cloud.google.com/appengine/docs/python/ndb/queryclass end_cursor is described as Ending point for search. I didn't find anywhere sample code how to use it. Since start_cursor parameter is used to return next X values, intuitively I though that end_cursor can be used to return previous X values but it doesn't work like that. So I was wandering if somebody has experience with that and can explain, provide some use case.

1
StackOverflow likes questions to be answerable in the sense that they are not too broad or general. I'd recommend editing your question to be a little more specific. This will increase the odds of getting a satisfactory answer.tumultous_rooster
maybe what you want is reversed cursor. cloud.google.com/appengine/docs/python/ndb/queries#cursorsmarcadian
thanks for response @marcadian, I am aware of that, I just don't understand for what end_cursor parameter is good and can be used for.zdenulo

1 Answers

1
votes

Datastore cursors are pointers to a specific position in a result set.

So in a result set of 1,000 records matching a query, when you issue a query with a "LIMIT 100" clause, the end cursor given back in the response could be used to get the next 100 records (or however many you like).

So, if you issue a query with. Start and end cursor, you'll get the results between those cursors.

Cursors can be very cost effective compared to "LIMIT 200, 100" style queries which still have to "scroll" through 300 records.