SQLAlchemy and going through a large result set [duplicate]

If you are using Flask-SqlAlchemy, see the paginate method of query. paginate offers several method to simplify pagination.

record_query = Record.query.paginate(page, per_page, False)
total = record_query.total
record_items = record_query.items

First page should be 1 otherwise the .total returns exception divided by zero

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)