Debian Codegraph @

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

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