`AsyncMethodRequired` is actually from
`sqlalchemy.ext.asyncio.exc`, so here it
should be referenced as `async_exc.AsyncMethodRequired`,
instead of `exc.AsyncMethodRequired`.
Fixes: #5529
Closes: #5545
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5545
Pull-request-sha:
d8f885c587dd058f909d4f3bdbec3d0fca176680
Change-Id: I6886558bfd33d3e9e283fbd60c0ec971a1f22c0c
"""
if kw.get("server_side_cursors", False):
- raise exc.AsyncMethodRequired(
+ raise async_exc.AsyncMethodRequired(
"Can't set server_side_cursors for async engine globally; "
"use the connection.stream() method for an async "
"streaming result set"
asyncio.TimeoutError, "", engine.connect(),
)
+ @async_test
+ async def test_create_async_engine_server_side_cursor(self, async_engine):
+ testing.assert_raises_message(
+ asyncio_exc.AsyncMethodRequired,
+ "Can't set server_side_cursors for async engine globally",
+ create_async_engine,
+ testing.db.url,
+ server_side_cursors=True,
+ )
+
class AsyncResultTest(EngineFixture):
@testing.combinations(