-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement cursor based pagination in PiccoloCRUD #15
Comments
Related - piccolo-orm/piccolo#47 |
Hi Daniel
Sorry for the long comment, but what do you think about this? If it's OK I can do PR, if it's not, just forget it :). Cheers. |
@sinisaos Great job! I haven't used cursor based pagination before, but I do know it's the recommended way as limit + offset isn't very performant in Postgres, and there are weird edge cases where you can miss rows, or get duplicate rows. If you make a pull request, I'll have a play around. I'm interested to try it out! Thanks. |
@dantownsend Thank you. I'll do it later tonight. |
Any updates on the implementation here.:) |
@satishdash All progress is at #34, but there has been no activity lately. If you have any code or ideas on how to improve it, feel free to contribute and make pull request. |
@satishdash Yeah, it has stalled a bit. Cursor based pagination is really complex - @sinisaos did a great job of getting it to work, but I still struggle to wrap my head around it entirely! Here is the implementation: The problem is it adds a lot of logic to That way we can add the new functionality, whilst keeping |
@dantownsend This is done in separate package. You can close this issue. |
Currently, only offset based pagination is supported in PiccoloCRUD (using the
__page
and__page_size
query params). There are issues with this, as outlined in this article.Modify PiccoloCRUD so it accepts a
__cursor
GET parameter. The value will be the ID of a row for now, but encoded as string. Encoding it as a string gives more flexibility (for example, we may want to return a UUID instead of an integer in the future).The response should then be something like:
If both the
__page
and__cursor
GET params are passed to an endpoint, an error should be returned.The text was updated successfully, but these errors were encountered: