Flask-SQLAlchemy raises TypeError: Query.paginate() takes 1 positional argument but 4 were given

Question:

I call Flask-SQLAlchemy’s query.paginate method with arguments. Recently this stopped working and instead raised a TypeError. How do I pass page and other arguments to query.paginate?

Ticker.query.paginate(page, app.config["TICKERS_PER_PAGE"], False)
TypeError: Query.paginate() takes 1 positional argument but 4 were given

Answers:

As of Flask-SQLAlchemy 3.0, all arguments to paginate are keyword-only.

Ticker.query.paginate(page=page, per_page=app.config["TICKERS_PER_PAGE"], error_out=False)
Answered By: davidism
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.