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

Method get_reset_query

asyncpg/connection.py:1763–1790  ·  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

1761 return con_ref
1762
1763 def get_reset_query(self):
1764 """Return the query sent to server on connection release.
1765
1766 The query returned by this method is used by :meth:`Connection.reset`,
1767 which is, in turn, used by :class:`~asyncpg.pool.Pool` before making
1768 the connection available to another acquirer.
1769
1770 .. versionadded:: 0.30.0
1771 """
1772 if self._reset_query is not None:
1773 return self._reset_query
1774
1775 caps = self._server_caps
1776
1777 _reset_query = []
1778 if caps.advisory_locks:
1779 _reset_query.append('SELECT pg_advisory_unlock_all();')
1780 if caps.sql_close_all:
1781 _reset_query.append('CLOSE ALL;')
1782 if caps.notifications and caps.plpgsql:
1783 _reset_query.append('UNLISTEN *;')
1784 if caps.sql_reset:
1785 _reset_query.append('RESET ALL;')
1786
1787 _reset_query = '\n'.join(_reset_query)
1788 self._reset_query = _reset_query
1789
1790 return _reset_query
1791
1792 def _set_proxy(self, proxy):
1793 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