I'm currently migrating from flask with Flask-SQLAlchemy, and really like how it's easy to hang onto a session that's scoped to each request. The example code I saw on the website all relies on passing the session down from the request handler.
What's the right way to create a class that holds onto the session object and works across requests? I'd love to write code like this:
def add_user(self):
self.session.add(...)
self.session.commit()