When I use the paginate of flask_sqlalchemy, can I limit it also?

567 Views Asked by At

My code: DbVote.query.order_by( (something).desc()).paginate( page, per_page=5, error_out=False)

For example, I have 1000 pieces of data, and just whant to get top 500, but I have used paginate, how can I to do?

1

There are 1 best solutions below

0
On

try this:

    DbVote.query.order_by((something).desc())
       .limit(500).from_self()
       .paginate(page, per_page=5, error_out=False)