flask-sqlalchemy icon indicating copy to clipboard operation
flask-sqlalchemy copied to clipboard

port query methods to select

Open davidism opened this issue 3 years ago • 0 comments

The query interface is legacy in SQLAlchemy 2.0, instead using the session.execute(select()) pattern. It's not possible (or at least not at all supported) to modify the Result returned from session.execute the way that Query could be.

Implement the or_404 and paginate methods on the db object directly, so that they can be used like db.one_or_404(select(User).filter_by(username=username)). The methods can still take query objects.

davidism avatar Sep 18 '22 18:09 davidism