MCPcopy Index your code
hub / github.com/MagicStack/asyncpg / get_reset_query

Method get_reset_query

asyncpg/connection.py:1732–1759  ·  view source on GitHub ↗

Return the query sent to server on connection release. The query returned by this method is used by :meth:`Connection.reset`, which is, in turn, used by :class:`~asyncpg.pool.Pool` before making the connection available to another acquirer. .. versionadded:: 0.30.0

(self)

Source from the content-addressed store, hash-verified

1730 return con_ref
1731
1732 def get_reset_query(self):
1733 """Return the query sent to server on connection release.
1734
1735 The query returned by this method is used by :meth:`Connection.reset`,
1736 which is, in turn, used by :class:`~asyncpg.pool.Pool` before making
1737 the connection available to another acquirer.
1738
1739 .. versionadded:: 0.30.0
1740 """
1741 if self._reset_query is not None:
1742 return self._reset_query
1743
1744 caps = self._server_caps
1745
1746 _reset_query = []
1747 if caps.advisory_locks:
1748 _reset_query.append('SELECT pg_advisory_unlock_all();')
1749 if caps.sql_close_all:
1750 _reset_query.append('CLOSE ALL;')
1751 if caps.notifications and caps.plpgsql:
1752 _reset_query.append('UNLISTEN *;')
1753 if caps.sql_reset:
1754 _reset_query.append('RESET ALL;')
1755
1756 _reset_query = '\n'.join(_reset_query)
1757 self._reset_query = _reset_query
1758
1759 return _reset_query
1760
1761 def _set_proxy(self, proxy):
1762 if self._proxy is not None and proxy is not None:

Callers 1

resetMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected