Does aiopg async with engine.acquire() close connection?

758 Views Asked by At

Lame question here. When running

async with engine.acquire() as conn:
        await conn.execute(...)

will the context manager close connection automatically? And does it imply that postgres connection will be closed too?

1

There are 1 best solutions below

0
On

From the code, it looks as if exiting the context manager will close the SQLAlchemy connection, but return it to the connection pool, so the Postgresql connection will remain open until the pool is released.