Open
Description
right now using this method is not async with nice, with the syntax:
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:
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__
Metadata
Metadata
Assignees
Labels
No labels