Closed simonprickett closed 2 years ago
In the meantime, FindQuery(expressions=[], model=self.model, offset=skip, limit=limit).execute()
works for me
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?
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()
Current functionality of the execution of queries appends all results together - https://github.com/redis/redis-om-python/blob/dcd84e0ab2686a3c6ff7f6c6a43ec49f4b65655f/aredis_om/model/model.py#L740
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.
@simonprickett - wiseaidev implemented this how it's described so I think we should go ahead and close this
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.