Query pagination in Python


What I’m doing: Processing whole query, where the result is saved to a separated JSON file and then processed elsewhere.

Sometimes the query result is too big. But I still want to be able to process the whole query.

What I would like to do: Process query, but by pages, e.g. 0-100 (this limit is nested inside query), 100-200, … until end of query. But when I don’t know how big the query will be, I don’t know this boundary. Is it possible to do this somehow automatically, or do I have to hardcode this pagination until I don’t get any result from the database?

Thank you very much for reply in advance! :slight_smile: