MCPcopy
hub / github.com/MagicStack/asyncpg / set_connect_args

Method set_connect_args

asyncpg/pool.py:513–535  ·  view source on GitHub ↗

r"""Set the new connection arguments for this pool. The new connection arguments will be used for all subsequent new connection attempts. Existing connections will remain until they expire. Use :meth:`Pool.expire_connections() `

(self, dsn=None, **connect_kwargs)

Source from the content-addressed store, hash-verified

511 return sum(h.is_connected() and h.is_idle() for h in self._holders)
512
513 def set_connect_args(self, dsn=None, **connect_kwargs):
514 r"""Set the new connection arguments for this pool.
515
516 The new connection arguments will be used for all subsequent
517 new connection attempts. Existing connections will remain until
518 they expire. Use :meth:`Pool.expire_connections()
519 <asyncpg.pool.Pool.expire_connections>` to expedite the connection
520 expiry.
521
522 :param str dsn:
523 Connection arguments specified using as a single string in
524 the following format:
525 ``postgres://user:pass@host:port/database?option=value``.
526
527 :param \*\*connect_kwargs:
528 Keyword arguments for the :func:`~asyncpg.connection.connect`
529 function.
530
531 .. versionadded:: 0.16.0
532 """
533
534 self._connect_args = [dsn]
535 self._connect_kwargs = connect_kwargs
536
537 async def _get_new_connection(self):
538 con = await self._connect(

Callers 1

Calls

no outgoing calls

Tested by 1