File tree Expand file tree Collapse file tree 8 files changed +19
-6
lines changed
Expand file tree Collapse file tree 8 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,11 @@ <h2 id="setup-middleware">Setup middleware</h2>
172172< p > Middleware handles the most important and complex part -
173173managing context and sessions.</ p >
174174< p > You can use the ready-made middleware components:</ p >
175+ < h3 id ="asgi-middleware "> ASGI middleware</ h3 >
176+ < pre > < code class ="language-python "> from context_async_sqlalchemy import ASGIHTTPDBSessionMiddleware
177+
178+ app.add_middleware(ASGIHTTPDBSessionMiddleware)
179+ </ code > </ pre >
175180< h3 id ="fastapi "> FastAPI</ h3 >
176181< pre > < code class ="language-python "> from context_async_sqlalchemy.fastapi_utils import (
177182 add_fastapi_http_db_session_middleware,
Original file line number Diff line number Diff line change @@ -214,5 +214,5 @@ <h2 id="how-it-works">How it works</h2>
214214
215215<!--
216216MkDocs version : 1.6.1
217- Build Date UTC : 2025-11-22 21:19:17.238880 +00:00
217+ Build Date UTC : 2025-11-23 21:26:35.871042 +00:00
218218-->
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -103,15 +103,15 @@ <h1 id="testing">Testing</h1>
103103solved - ensuring data isolation between tests.</ p >
104104< p > There are basically two approaches:</ p >
105105< ol >
106- < li > Separate sessions. </ li >
106+ < li > Separate sessions</ li >
107107</ ol >
108108< p > The test has its own session that it uses to prepare data and verify
109109results after execution.
110110The application also has its own session.
111111Data isolation is achieved by clearing all tables at the end of each test
112112(and once before running all tests).</ p >
113113< ol >
114- < li > Shared session and transaction.
114+ < li > Shared session and transaction
115115The test and the application share the same session and transaction.
116116Data isolation is achieved by rolling back the transaction at
117117the end of the test.</ li >
Original file line number Diff line number Diff line change @@ -81,6 +81,14 @@ managing context and sessions.
8181
8282You can use the ready-made middleware components:
8383
84+ ### ASGI middleware
85+
86+ ``` python
87+ from context_async_sqlalchemy import ASGIHTTPDBSessionMiddleware
88+
89+ app.add_middleware(ASGIHTTPDBSessionMiddleware)
90+ ```
91+
8492### FastAPI
8593
8694``` python
Original file line number Diff line number Diff line change 11[project ]
22name = " context-async-sqlalchemy"
3- version = " 2.0.2 "
3+ version = " 2.0.3 "
44description = " A convenient way to configure and work with an async SQLAlchemy session through context in asynchronous applications"
55readme = " README.md"
66authors = [
You can’t perform that action at this time.
0 commit comments