Closed mbrancato closed 1 year ago
It's already implemented, as the init
kwarg to connect
and create_pool
:
pool = await asyncpg.create_pool(..., init=your_callback)
Is that what you're looking for?
Yes, I think that works. I didn't realize that form the docs.
In a very large environment, pooling along is not enough, and we use pgbouncer to help control connections to the DB. The problem is that pgbouncer does not support some of the parameters. This includes settings like
statement_timeout
andlock_timeout
.Other pooling libraries support a set of queries that run after connect and at other points in the connection lifecycle.
It would be nice if asyncpg could allow queries / exec to call
SET
in the connection before it enters the pool to enforce these settings.