cleanup aiopg.pool.Pool.cursor method
- Linguagem predominante
- Python
- Estrelas
- 1.4k
- Forks
- 170
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
right now using this method is not async with nice, with the syntax:
```python
with (yield from pool.cursor()) as cur:
yield from cur.execute("SELECT 1")
```
Based on the usage of context managers in aiopg, it should instead behavior like aiopg.create_pool, to yield the following usage:
```python
async with pool.cursor() as cur:
yield from cur.execute("SELECT 1")
```
In order to accomplish this aiopg.pool.Pool.cursor should not be marked a coroutine, and the acquisition of the connection and cursor should not happen until `__aenter__` of _PoolCursorContextManager. With the current design probably the easiest way would be to pass a coroutine closure to _PoolCursorContextManager to return the conn and cur during `__aenter__`
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.