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

Method fetch

asyncpg/connection.py:666–700  ·  view source on GitHub ↗

Run a query and return the results as a list of :class:`Record`. :param str query: Query text. :param args: Query arguments. :param float timeout: Optional timeout value in seconds. :param type record_class: If specifie

(
        self,
        query,
        *args,
        timeout=None,
        record_class=None
    )

Source from the content-addressed store, hash-verified

664 return prepared_stmt.PreparedStatement(self, query, stmt)
665
666 async def fetch(
667 self,
668 query,
669 *args,
670 timeout=None,
671 record_class=None
672 ) -> list:
673 """Run a query and return the results as a list of :class:`Record`.
674
675 :param str query:
676 Query text.
677 :param args:
678 Query arguments.
679 :param float timeout:
680 Optional timeout value in seconds.
681 :param type record_class:
682 If specified, the class to use for records returned by this method.
683 Must be a subclass of :class:`~asyncpg.Record`. If not specified,
684 a per-connection *record_class* is used.
685
686 :return list:
687 A list of :class:`~asyncpg.Record` instances. If specified, the
688 actual type of list elements would be *record_class*.
689
690 .. versionchanged:: 0.22.0
691 Added the *record_class* parameter.
692 """
693 self._check_open()
694 return await self._execute(
695 query,
696 args,
697 0,
698 timeout,
699 record_class=record_class,
700 )
701
702 async def fetchval(self, query, *args, column=0, timeout=None):
703 """Run a query and return a value in the first row.

Callers 2

add_listenerMethod · 0.95
remove_listenerMethod · 0.95

Calls 2

_check_openMethod · 0.95
_executeMethod · 0.95

Tested by

no test coverage detected