I have been googling and reading through the SQLAlchemy documentation but haven't found what I am looking for.
I am looking for a function in SQLAlchemy that limits the number of results returned by a query to a certain number, for example: 5? Something like first()
or all()
.
for sqlalchemy >= 1.0.13
Use the limit method.
query(Model).filter(something).limit(5).all()