Sqlalchemy does not work with pagination Sqlalchemy does not work with pagination flask flask

Sqlalchemy does not work with pagination


You are calling paginate() on a query object provided by SQLAlchemy, but the pagination functionality is only available from a Flask-SQLAlchemy, which subclasses the base query object to add this and other features, including the get_or_404() and first_or_404() methods that you also found to not work.

All this happens because you created your database and your model using SQLAlchemy directly instead of using the facilities provided by Flask-SQLAlchemy. If you do this according to the Flask-SQLAlchemy documentation you will find that everything will work just fine.