Falcon Middleware: SQLAlchemy Integration¶
falcon-sqla package provides a middleware component for managing
The manager component can also serve as a base building block or a recipe for
more complex use cases, such as applications leveraging multiple database
Simply install the falcon-sqla package from PyPi:
$ pip install falcon-sqla
For more installation options, see Installation.
falcon_sqla.Manager middleware in a
be renamed to
falcon.App in Falcon 3.0+):
engine = create_engine('dialect+driver://my/database') manager = falcon_sqla.Manager(engine) app = falcon.API(middleware=[manager.middleware]) # The database session will be available as req.context.session
More usage scenarios are covered in the User Guide.