From f0fa392e7272903e4ca8db5cb178ce720cc0e7a1 Mon Sep 17 00:00:00 2001 From: hamed Date: Tue, 4 Mar 2025 12:06:52 +0300 Subject: [PATCH] fix breaking change on asyncpg 0.30.0 Add version check for asyncpg in executor function --- src/gino/dialects/asyncpg.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gino/dialects/asyncpg.py b/src/gino/dialects/asyncpg.py index 6a59d86..ab1956a 100644 --- a/src/gino/dialects/asyncpg.py +++ b/src/gino/dialects/asyncpg.py @@ -3,6 +3,7 @@ import time import warnings +from pip._internal.utils import packaging from sqlalchemy import util, exc, sql from sqlalchemy.dialects.postgresql import ( # noqa: F401 ARRAY, @@ -175,6 +176,8 @@ async def async_execute(self, query, timeout, args, limit=0, many=False): def executor(state, timeout_): if many: + if packaging.version.parse(asyncpg.__version__) >= packaging.version.parse('0.30.0'): + return _protocol.bind_execute_many(state, args, "", timeout_, return_rows=True) return _protocol.bind_execute_many(state, args, "", timeout_) else: return _protocol.bind_execute(state, args, "", limit, True, timeout_)