Skip to content

Add a page function for find #284

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

Closed
simonprickett opened this issue Jun 27, 2022 · 5 comments
Closed

Add a page function for find #284

simonprickett opened this issue Jun 27, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@simonprickett
Copy link
Contributor

Allow the user to page through all results rather than returning them all in one go... .find().page(offset, limit). See Redis OM Node for a good example.

@mpmX
Copy link

mpmX commented Jun 28, 2022

In the meantime, FindQuery(expressions=[], model=self.model, offset=skip, limit=limit).execute() works for me

@iamvishalkhare
Copy link

In the meantime, FindQuery(expressions=[], model=self.model, offset=skip, limit=limit).execute() works for me

How do I use this? Can you put up an example code snippet?

@mpmX
Copy link

mpmX commented Jul 20, 2022

How do I use this? Can you put up an example code snippet?

Assuming your model class is called Entity:

from redis_om import FindQuery
expressions = [(Entity.some_attribute == 1)]
skip = 10
limit = 10
result = FindQuery(expressions=expressions, model=Entity, offset=skip, limit=limit).execute()

@sav-norem
Copy link

Current functionality of the execution of queries appends all results together -

This change will require changing how results are returned to users, not just adding a function. Closed the draft PR I had for this after realizing the above.

@sav-norem
Copy link

@simonprickett - wiseaidev implemented this how it's described so I think we should go ahead and close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants