crate-python icon indicating copy to clipboard operation
crate-python copied to clipboard

Support SQLAlchemy dialect with asyncpg

Open amotl opened this issue 3 years ago • 1 comments

Hi there,

after closing #394 and bringing in #391, we may want to look at SQLAlchemy support for Python asyncio. Currently, trying to invoke the CrateDB driver like postgresql+asyncpg:// croaks like

>>> from sqlalchemy.ext.asyncio import create_async_engine
>>> create_async_engine("crate+asyncpg://crate@localhost/test")
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:crate.asyncpg

So, the CrateDB dialect will have to be accompanied by a special asyncio mediation layer, like dialects/postgresql/asyncpg.py.

With kind regards, Andreas.

amotl avatar May 18 '22 14:05 amotl

Couldn't async be implemented with aiohttp so that support for connecting to a cluster instead of a single node would still be available?

Is there a way to connect to Crate from asyncpg so that it will round-robin requests between nodes?

robd003 avatar Aug 26 '22 01:08 robd003