Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for create_async_engine #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

douglasmdev
Copy link

This PR works as a "v0" for adding async support. We're simply adding a libsql dialect that's flagged as async without modifying the dbapi itself. As it stands, this PR will allow usage of the create_async_engine api: https://docs.sqlalchemy.org/en/20/orm/extensions/asyncio.html#sqlalchemy.ext.asyncio.create_async_engine

@douglasmdev douglasmdev marked this pull request as draft October 3, 2023 19:17
- provides compatibility with create_async_engine and async_session
@ncecere
Copy link

ncecere commented Feb 6, 2024

Is there any movement on this ?

@tpougy
Copy link

tpougy commented Jun 8, 2024

@douglasmdev, first of all thank you for your contribution to the project. I'm not the maintainer of this repo but I'm using the package in an async project and I had a question about your PR.

In the disclaimer inside the file “sqlalchemy_libsql/libsql_async.py” you say: “While this dialect allows for async_engine compatibility with libsql, the dbapi remains synchronous”.

I'm using Litestar as a framework to implement a CRUD api in python that would connect via async sqlalchemy with a libsql DB (turso). In my project all routes are async.

Although I have a background in computer engineering, I'm struggling to fully understand the short and medium term impacts that using sqlalchemy-libsql could have on system performance since the DBAPI remains sync.

Considering this sync characteristic of the libsql DBAPI, wouldn't my routes that interact with the DB, although declared as async, work synchronously? What's confusing me about all this is that all my sqlalchemy interactions with the database are called with await so that it's possible to return fetched data or a success/error code to the client. Wouldn't that make the interactions synchronous anyway? If so, there would be no impact on the DBAPI being synced, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants