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

Method fetchmany

asyncpg/connection.py:763–804  ·  view source on GitHub ↗

Run a query for each sequence of arguments in *args* and return the results as a list of :class:`Record`. :param query: Query to execute. :param args: An iterable containing sequences of arguments for the query. :param float timeout:

(
        self,
        query,
        args,
        *,
        timeout: typing.Optional[float]=None,
        record_class=None,
    )

Source from the content-addressed store, hash-verified

761 return data[0]
762
763 async def fetchmany(
764 self,
765 query,
766 args,
767 *,
768 timeout: typing.Optional[float]=None,
769 record_class=None,
770 ):
771 """Run a query for each sequence of arguments in *args*
772 and return the results as a list of :class:`Record`.
773
774 :param query:
775 Query to execute.
776 :param args:
777 An iterable containing sequences of arguments for the query.
778 :param float timeout:
779 Optional timeout value in seconds.
780 :param type record_class:
781 If specified, the class to use for records returned by this method.
782 Must be a subclass of :class:`~asyncpg.Record`. If not specified,
783 a per-connection *record_class* is used.
784
785 :return list:
786 A list of :class:`~asyncpg.Record` instances. If specified, the
787 actual type of list elements would be *record_class*.
788
789 Example:
790
791 .. code-block:: pycon
792
793 >>> rows = await con.fetchmany('''
794 ... INSERT INTO mytab (a, b) VALUES ($1, $2) RETURNING a;
795 ... ''', [('x', 1), ('y', 2), ('z', 3)])
796 >>> rows
797 [<Record row=('x',)>, <Record row=('y',)>, <Record row=('z',)>]
798
799 .. versionadded:: 0.30.0
800 """
801 self._check_open()
802 return await self._executemany(
803 query, args, timeout, return_rows=True, record_class=record_class
804 )
805
806 async def copy_from_table(self, table_name, *, output,
807 columns=None, schema_name=None, timeout=None,

Callers

nothing calls this directly

Calls 2

_check_openMethod · 0.95
_executemanyMethod · 0.95

Tested by

no test coverage detected