Skip to content

Commit d0985c4

Browse files
committed
upd readme
1 parent 3a1d011 commit d0985c4

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def test_request():
6969
7070
```python
7171
# NOTE: The with context manager does not support multi-launch number_runs > 1
72+
# NOTE: Also you can use `async with` if you capture queries in async context.
7273
with CaptureQueries(number_runs=1, advanced_verb=True) as ctx:
7374
response = self.client.get(url)
7475
@@ -123,4 +124,5 @@ settings.PRINTER_HANDLERS.append("path.to.your.handler.SomeHandler")
123124
```
124125
125126
## TODO:
126-
1. Add support for other ORM's, SQLAlchemy, etc.
127+
1. Add support for async loop and async func decorator, __acall__, __aiter__, __anext__
128+
2. Add support for other ORM's, SQLAlchemy, etc.

src/capture_db_queries/decorators.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,15 @@ def wrapper_cls(self) -> type[BaseExecutionWrapper]:
179179
return ExplainExecutionWrapper
180180
return BaseExecutionWrapper
181181

182-
async def __aenter__(self):
183-
await sync_to_async(self.__enter__)()
184-
return self
182+
async def __aenter__(self) -> Self:
183+
return await sync_to_async(self.__enter__)()
185184

186185
async def __aexit__(
187186
self,
188187
exc_type: type[BaseException] | None,
189188
exc_value: BaseException | None,
190189
traceback: TracebackType | None,
191-
):
190+
) -> None:
192191
await sync_to_async(self.__exit__)(exc_type, exc_value, traceback)
193192

194193
def __enter__(self) -> Self:

0 commit comments

Comments
 (0)