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

Connection received from cursor is not the created aiosqlite connection #285

Open
kattassen opened this issue Mar 10, 2024 · 0 comments
Open

Comments

@kattassen
Copy link

kattassen commented Mar 10, 2024

Description

When fetching the connection from a cursor it responds with the underlaying sqlite3 connection instead of the aiosqlite. This makes the application crash with the following message if trying to run a commit on it:
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 139659649398464 and this is thread id 13...

    con = await aiosqlite.connect(":memory:")
    cur = await con.cursor()

    await con.commit()
    await cur.connection.commit()  # This row causes a crash since the connection fetched is not the created aiosqlite connection, but instead the underlaying sqlte3 connection

Details

  • OS: Linux (6.2.0)
  • Python version: 3.11.6
  • aiosqlite version: 0.20.0 (latest pip install?)
  • Can you repro on 'main' branch? Have not tried
  • Can you repro in a clean virtualenv? Yes (running unitests with tox)
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

No branches or pull requests

1 participant