You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[1.4] The asyncio extension requires an async driver to be used. The loaded 'psycopg2' is not async. #6044
aiohttp: Traceback (most recent call last):
aiohttp: File "/usr/local/lib/python3.8/site-packages/aiohttp/worker.py", line 57, in run
aiohttp: self.loop.run_until_complete(self._task)
aiohttp: File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
aiohttp: File "/usr/local/lib/python3.8/site-packages/aiohttp/worker.py", line 84, in _run
aiohttp: await runner.setup()
aiohttp: File "/usr/local/lib/python3.8/site-packages/aiohttp/web_runner.py", line 275, in setup
aiohttp: self._server = await self._make_server()
aiohttp: File "/usr/local/lib/python3.8/site-packages/aiohttp/web_runner.py", line 375, in _make_server
aiohttp: await self._app.startup()
aiohttp: File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 416, in startup
aiohttp: await self.on_startup.send(self)
aiohttp: File "/usr/local/lib/python3.8/site-packages/aiohttp/signals.py", line 34, in send
aiohttp: await receiver(*args, **kwargs) # type: ignore
aiohttp: File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 534, in _on_startup
aiohttp: await it.__anext__()
aiohttp: File "/aiohttp/app/main.py", line 51, in db_ctx
aiohttp: engine = create_async_engine(dsn, future=True, pool_size=max_size)
aiohttp: File "/usr/local/lib/python3.8/site-packages/sqlalchemy/ext/asyncio/engine.py", line 41, in create_async_engine
aiohttp: return AsyncEngine(sync_engine)
aiohttp: File "/usr/local/lib/python3.8/site-packages/sqlalchemy/ext/asyncio/engine.py", line 531, in __init__
aiohttp: raise exc.InvalidRequestError(
aiohttp: sqlalchemy.exc.InvalidRequestError: The asyncio extension requires an async driver to be used. The loaded 'psycopg2' is not async.
The only relevant change is changing the version from beta1 to beta3. So, not sure if something broke in the latest beta?
We unfortunately assumed that people would use async drivers with async sqlalchemy, so there was no explicit check. Since that's not the case we added some additional check in beta2 and beta3
Regarding woking, it does work exactly the same as using time.sleep with asyncio: it will sleep ok but it's not what you usually want to do with asyncio, since it will block the loop while doing so
Activity
CaselIT commentedon Mar 14, 2021
Hi,
that is expected. psyncpg2 is not an async driver. Please use asyncpg if you want to use asyncio with postgresql.
Dreamsorcerer commentedon Mar 14, 2021
I'm just confused why it worked on beta1...
Dreamsorcerer commentedon Mar 14, 2021
OK, I see that both asyncpg and psycopg were being installed (which is probably my mistake).
So, I'm guessing some dependency resolution changed between beta1 and beta3, so it now prefers psycopg even though it can't use it?
CaselIT commentedon Mar 14, 2021
We unfortunately assumed that people would use async drivers with async sqlalchemy, so there was no explicit check. Since that's not the case we added some additional check in beta2 and beta3
Regarding woking, it does work exactly the same as using
time.sleepwith asyncio: it will sleep ok but it's not what you usually want to do with asyncio, since it will block the loop while doing soCaselIT commentedon Mar 14, 2021
No change was done. please refer to the documentation on how to specify a dialect: https://docs.sqlalchemy.org/en/14/dialects/postgresql.html#module-sqlalchemy.dialects.postgresql.asyncpg