From 7eec0df4870ea937000728a12d1f3115c45cdef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Baltaz=C3=A1r=20Radics?= Date: Sat, 12 Mar 2022 23:43:49 +0100 Subject: [PATCH] Add record_class parameter Pool.fetch and Pool.fetchrow --- asyncpg/pool.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/asyncpg/pool.py b/asyncpg/pool.py index 69daa77d..14e4be7e 100644 --- a/asyncpg/pool.py +++ b/asyncpg/pool.py @@ -576,7 +576,13 @@ async def executemany(self, command: str, args, *, timeout: float=None): async with self.acquire() as con: return await con.executemany(command, args, timeout=timeout) - async def fetch(self, query, *args, timeout=None) -> list: + async def fetch( + self, + query, + *args, + timeout=None, + record_class=None + ) -> list: """Run a query and return the results as a list of :class:`Record`. Pool performs this operation using one of its connections. Other than @@ -586,7 +592,12 @@ async def fetch(self, query, *args, timeout=None) -> list: .. versionadded:: 0.10.0 """ async with self.acquire() as con: - return await con.fetch(query, *args, timeout=timeout) + return await con.fetch( + query, + *args, + timeout=timeout, + record_class=record_class + ) async def fetchval(self, query, *args, column=0, timeout=None): """Run a query and return a value in the first row. @@ -602,7 +613,7 @@ async def fetchval(self, query, *args, column=0, timeout=None): return await con.fetchval( query, *args, column=column, timeout=timeout) - async def fetchrow(self, query, *args, timeout=None): + async def fetchrow(self, query, *args, timeout=None, record_class=None): """Run a query and return the first row. Pool performs this operation using one of its connections. Other than @@ -612,7 +623,12 @@ async def fetchrow(self, query, *args, timeout=None): .. versionadded:: 0.10.0 """ async with self.acquire() as con: - return await con.fetchrow(query, *args, timeout=timeout) + return await con.fetchrow( + query, + *args, + timeout=timeout, + record_class=record_class + ) async def copy_from_table( self,