MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / set_connect_args

Method set_connect_args

asyncpg/pool.py:630–652  ·  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

628 return sum(h.is_connected() and h.is_idle() for h in self._holders)
629
630 def set_connect_args(self, dsn=None, **connect_kwargs):
631 r"""Set the new connection arguments for this pool.
632
633 The new connection arguments will be used for all subsequent
634 new connection attempts. Existing connections will remain until
635 they expire. Use :meth:`Pool.expire_connections()
636 <asyncpg.pool.Pool.expire_connections>` to expedite the connection
637 expiry.
638
639 :param str dsn:
640 Connection arguments specified using as a single string in
641 the following format:
642 ``postgres://user:pass@host:port/database?option=value``.
643
644 :param \*\*connect_kwargs:
645 Keyword arguments for the :func:`~asyncpg.connection.connect`
646 function.
647
648 .. versionadded:: 0.16.0
649 """
650
651 self._connect_args = [dsn]
652 self._connect_kwargs = connect_kwargs
653
654 async def _get_new_connection(self):
655 con = await self._connect(

Calls

no outgoing calls