From: CommanderKeynes Date: Sun, 5 Jan 2025 03:34:37 +0000 (-0600) Subject: First attmept X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13d3ca6f2a76d94fffde58a6ec485d19b3a5ba4f;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git First attmept --- diff --git a/lib/sqlalchemy/dialects/postgresql/asyncpg.py b/lib/sqlalchemy/dialects/postgresql/asyncpg.py index ecb09560fc..329b543213 100644 --- a/lib/sqlalchemy/dialects/postgresql/asyncpg.py +++ b/lib/sqlalchemy/dialects/postgresql/asyncpg.py @@ -584,6 +584,8 @@ class AsyncAdapt_asyncpg_cursor(AsyncAdapt_dbapi_cursor): else: self._rows = deque(await prepared_stmt.fetch(*parameters)) status = prepared_stmt.get_statusmsg() + if status is None: + status = "" reg = re.match( r"(?:SELECT|UPDATE|DELETE|INSERT \d+) (\d+)", status diff --git a/test/dialect/postgresql/test_async_pg_py3k.py b/test/dialect/postgresql/test_async_pg_py3k.py index feff60c578..be08d3b712 100644 --- a/test/dialect/postgresql/test_async_pg_py3k.py +++ b/test/dialect/postgresql/test_async_pg_py3k.py @@ -331,3 +331,12 @@ class AsyncPgTest(fixtures.TestBase): async with engine.begin() as conn: await conn.execute(select(1)) assert len(cache) > 0 + + @async_test + async def test_name_connection_func(self, metadata, async_testing_engine): + + engine = async_testing_engine( + options={"connect_args": {"prepared_statement_name_func": name_f}}, + ) + async with engine.begin() as conn: + await conn.execute("")