Debian Codegraph @

docs/examples/contrib/sqlalchemy/plugins/sqlalchemy_sync_before_send_handler.py

raw
1 from __future__ import annotations
2
3 from litestar import Litestar
4 from litestar.plugins.sqlalchemy import SQLAlchemyInitPlugin, SQLAlchemySyncConfig, sync_autocommit_before_send_handler
5
6 config = SQLAlchemySyncConfig(
7 connection_string="sqlite:///:memory:",
8 before_send_handler=sync_autocommit_before_send_handler,
9 )
10 plugin = SQLAlchemyInitPlugin(config=config)
11
12 app = Litestar(route_handlers=[], plugins=[plugin])