Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading