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

Method fetch

asyncpg/pool.py:730–751  ·  view source on GitHub ↗

Run a query and return the results as a list of :class:`Record`. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.fetch() `. .. versionadded:: 0.10.0

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

Source from the content-addressed store, hash-verified

728 return await con.executemany(command, args, timeout=timeout)
729
730 async def fetch(
731 self,
732 query,
733 *args,
734 timeout=None,
735 record_class=None
736 ) -> list:
737 """Run a query and return the results as a list of :class:`Record`.
738
739 Pool performs this operation using one of its connections. Other than
740 that, it behaves identically to
741 :meth:`Connection.fetch() <asyncpg.connection.Connection.fetch>`.
742
743 .. versionadded:: 0.10.0
744 """
745 async with self.acquire() as con:
746 return await con.fetch(
747 query,
748 *args,
749 timeout=timeout,
750 record_class=record_class
751 )
752
753 async def fetchval(self, query, *args, column=0, timeout=None):
754 """Run a query and return a value in the first row.

Callers 15

runnerFunction · 0.45
test_compositesMethod · 0.45
test_range_typesMethod · 0.45
test_multirange_typesMethod · 0.45
test_enumMethod · 0.45

Calls 1

acquireMethod · 0.95

Tested by 15

test_compositesMethod · 0.36
test_range_typesMethod · 0.36
test_multirange_typesMethod · 0.36
test_enumMethod · 0.36