1. AsyncSession does NOT own the connection

The connection pool owns the connections.

The session:

Borrows a connection from the pool

Uses it

Returns it back to the pool when done

The session itself is just a unit-of-work + identity map .


  1. What async with async_session() as session: guarantees

When the with block exits:

The session is closed

Any checked-out connection is returned to the pool

SQLAlchemy does NOT blindly trust the connection

The pool decides whether to:

keep it

or discard it

So yes — the connection is returned in all cases, but whether it is reused or dropped depends on its health.


  1. Case A — Session used, no error (healthy path)