Search code examples
pythonpipsqlalchemypython-asyncio

How to access sqlalchemy's asyncio extension?


I've tried to use sqlalchemy.ext.asyncio: I installed it using following command (like in official docs):

$ pip install sqlalchemy[asyncio]

But i got this error:

AttributeError: module 'sqlalchemy.ext' has no attribute 'asyncio'

How to install sqlalchemy's asyncio correctly?

UPD: I've also installed sqlalchemy as follows: pip install sqlalchemy


Solution

  • You only need to install SQLAlchemy.

    Then :

    from sqlalchemy.ext.asyncio import AsyncEngine
    
    print(AsyncEngine)
    

    works fine for me.

    Adding

    pip install sqlalchemy[asyncio]
    

    is optional and only necessary if you have an unusual machine.