From e98aa6950777b349e0d279a42e7173f119256638 Mon Sep 17 00:00:00 2001 From: Martastain Date: Tue, 8 Oct 2024 11:01:50 +0200 Subject: [PATCH] feat: add fetchrow method to postgres --- ayon_server/lib/postgres.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ayon_server/lib/postgres.py b/ayon_server/lib/postgres.py index dbc1e8d2..34c1c297 100644 --- a/ayon_server/lib/postgres.py +++ b/ayon_server/lib/postgres.py @@ -151,6 +151,14 @@ async def fetch(cls, query: str, *args: Any, timeout: float = 60): async with cls.acquire() as connection: return await connection.fetch(query, *args, timeout=timeout) + @classmethod + async def fetchrow(cls, query: str, *args: Any, timeout: float = 60): + """Run a query and return the first row as a Record.""" + if cls.pool is None: + raise ConnectionError + async with cls.acquire() as connection: + return await connection.fetchrow(query, *args, timeout=timeout) + @classmethod async def iterate( cls,