Skip to content

asyncio-compatible dialect #212

@cancan101

Description

@cancan101

SQLAlchemy 1.4 now supports Python asyncio. In order to take advantage of this, the dialect must be "asyncio-compatible". It would be great to have a version of the base Dialect that can be used for this.

A discussion for what that entails: sqlalchemy/sqlalchemy#7854.

Currently the APSWDialect class subclasses SQLiteDialect, which is not async. There is a SQLiteDialect_aiosqlite that could potentially be used. The goal here is not necessarily to have async operations vis a vis sqlite but rather to allow async operations when connecting to the APIs.

This might be tricky as you would want this to be an async iterator:

def _convert(self, cursor: "apsw.Cursor") -> Iterator[Tuple[Any, ...]]:

and then likewise have the get_rows call be an async iterator:
self.data = (
tuple(row.get(name) for name in ["rowid", *column_names]) for row in rows
)

I filed this upstream though I am not 100% sure this is the right way to solve the ask: rogerbinns/apsw#325

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions