From your question ...
that the method paginate() works on BaseQuery which is also Query
I think they confuse you here. "Query" refers to an SQLAlchemy Query object. "BaseQuery" refers to the Flask-SQLALchemy BaseQuery , which is a subclass of Query . This subclass includes helpers such as first_or_404() and paginate() . However, this means that the Query object does NOT have a paginate() function. How you actually create the object that you call for the Query object depends on whether you are dealing with a Query or BaseQuery .
In this code, you get an SQLAlchemy Query object, which results in an error:
db.session.query(models.Post).paginate(...)
If you use the following code, you get the pagination you are looking for because you are dealing with a BaseQuery object (from Flask-SQLAlchemy), not a Query object (from SQLAlchemy).
models.Post.query.paginate(...)
source share