An upgrade from SQLAlchemy version 1.4.0b2 to 1.4.0b3 results in the following error when attempting to connect to a SQLite engine, using the asyncio extension.
>>> from sqlalchemy.ext.asyncio import create_async_engine
>>> engine = create_async_engine('sqlite:///database.db', echo=True, future=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<...>/venv/lib/python3.9/site-packages/sqlalchemy/ext/asyncio/engine.py", line 41, in create_async_engine
return AsyncEngine(sync_engine)
File "/.../venv/lib/python3.9/site-packages/sqlalchemy/ext/asyncio/engine.py", line 531, in __init__
raise exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: The asyncio extension requires an async driver to be used. The loaded 'pysqlite' is not async.
Is this due to an incompatibility between the SQLite driver and the asyncio extension? However if this was the case, why does it work on version 1.4.0b2?
>>> from sqlalchemy.ext.asyncio import create_async_engine
>>> engine = create_async_engine('sqlite:///database.db', echo=True, future=True)
>>> engine
<sqlalchemy.ext.asyncio.engine.AsyncEngine object at 0x7f9530101180>
Also note that using the asyncpg driver for postgres works (url beginning postgresql+asyncpg://). All tests were performed using python version 3.9.2.
I understand that the asyncio extension should be regarded as 'alpha level', and therefore subject to change, but I would like to know whether this is a bug, or a problem specific to SQLite.
aiosqliteis supported, but you need to specify the driver in the connection string. Otherwise it will usesqlite3(i.e.pysqlite) by default.