Comments (4)
On a bit more research, 3. Seems to be a bit antipattern for DuckDB.
I've added support along the lines of 2, in 8fe980c.
This is released in 0.0.3
from sqltools-duckdb-driver.
I've found edge cases where I get a read-write locking error
In particular:
- Connect to SQL tools, (but don't run any queries yet)
- This creates a .wal file (write ahead log - a file containing changes yet to be commited to db)
- Then connect to Evidence / something else
- Throws error
IO Error: Could not set lock on file "../../needful_things.duckdb": Resource temporarily unavailable
If you subsequently run a query, then this appears to close the connection, and the .wal file is deleted. Connecting to external tools now works again.
I'll open an issue for this as it may help people get around it
from sqltools-duckdb-driver.
Clarifying current behaviour:
Three types of connection
- Local db eg
needful_things.duckdb
- opens in READONLY - Motherduck - opens in READONLY
- In-memory database
:memory:
(discarded when the connection is closed) - opens in READWRITE
READWRITE
As i suspected, any READWRITE connection that we open will lock the DB. Great explanation here
so we have a couple of options I can think of:
- Naively implement READWRITE: this will mean when using SQLTools, you will not be able to use other processes (eg Evidence) to access the DB. You would need to disconnect SQLTools (eg from the sidebar) before using the other tool.
- Add a setting for READWRITE: you choose in the connection config if you want to be able to write in the db. You can toggle this on for when writing and off for when not.
- Close the DuckDB connection after every query. This should release the lock. However as described in the above comment, this is likely to be a performance drag.
I'm leaning towards option 3 as the best UX.
from sqltools-duckdb-driver.
@archiewood thank you so much! You have made my onboarding process so much easier. This is working a treat for me.
Also i dont need to close the duckdb connection in sqltools when using evidence. Maybe if i have a long running write job running in SQLtools and then run a query from evidence i am guessing that is when it will through an error.
from sqltools-duckdb-driver.
Related Issues (11)
- Locks duckdb file while in use HOT 2
- Unable to view schema for a table. HOT 4
- Latest release removed support for any vscode before 1.87 (Feb 2024) HOT 2
- Update DuckDB to 0.10.2
- Not compatible with windows / linux HOT 4
- Read/Write Locks Database HOT 5
- All views within a DB are shown within each schema HOT 3
- Support remote development/dev container HOT 1
- 0.9.0 support HOT 5
- Update duckdb to 0.9.2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqltools-duckdb-driver.