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 a method in hook to return cursor for multiple parallel database operations #6

Open
sunank200 opened this issue Feb 7, 2023 · 1 comment

Comments

@sunank200
Copy link
Contributor

Currently, if multiple database operations are done on DuckDB parallelly, it doesn't work with the current provider by default. Reason for this is that in DuckDB a single connection is thread-safe but is locked for the duration of the queries, effectively serializing database access in this case.

As per documentation, the hook should also return the cursor instead. If you want to create a second connection to an existing database, you can use the cursor() method.

@pgzmnk
Copy link

pgzmnk commented Feb 10, 2023

Agreed. It might make sense to return the cursor on the catch statement of a try:catch block on the specific exception.

sqlalchemy.exc.OperationalError: (duckdb.IOException) IO Error: Could not set lock on file "/tmp/db.duckdb": Resource temporarily unavailable

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

2 participants