asyncpg icon indicating copy to clipboard operation
asyncpg copied to clipboard

Implement AsyncContextManager for connection

Open pauldraper opened this issue 4 years ago • 1 comments

Ideally, the following code would work:

import asyncpg

async def main():
    async with asyncpg.connect() as conn: #
        await conn.execute("SELECT")

Instead, the connection must be managed manually.

pauldraper avatar May 24 '21 08:05 pauldraper

Looks like a good improvement to me. Feel free to send a PR!

elprans avatar May 24 '21 16:05 elprans