Skip to content

Commit 8fe980c

Browse files
committed
docs and redo option naming
1 parent a49eb35 commit 8fe980c

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This driver is maintained by [Evidence](https://evidence.dev): Publish BI report
1717
- **Explore DB** tables and columns in the sidebar
1818
- **View** table results by selecting them in the sidebar
1919
- **Autocomplete** for common keywords (e.g. SELECT, FROM, WHERE) and table names
20+
- **Read/Write** connections
2021

2122
### Connect Local and In-Memory DBs
2223

@@ -35,6 +36,16 @@ This driver is maintained by [Evidence](https://evidence.dev): Publish BI report
3536

3637
![Autocomplete](https://github.com/evidence-dev/sqltools-duckdb-driver/blob/master/docs/images/autocomplete.gif?raw=true)
3738

39+
### Read/Write Connections
40+
41+
DuckDB has two access modes:
42+
1. **Read/Write:** One process can both read and write to the database.
43+
2. **Read Only:** Multiple processes can read from the database, but no processes can write.
44+
45+
If you open another connection to a database that is already open in read/write mode, you may get an error. Close the read/write connection to resolve this.
46+
47+
[More Info](https://duckdb.org/faq#how-does-duckdb-handle-concurrency)
48+
3849
## Not Supported
3950
- Loading extensions not included in the [default Node.js installation](#DuckDB-Extensions-Supported)
4051

connection.schema.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
"type": "string",
1414
"minLength": 1
1515
},
16-
"readWrite": {
17-
"title": "Enable Read/Write",
18-
"type": "boolean",
19-
"default": false,
20-
"description": "Note: Read/Write connections prevent other connections until they are closed."
16+
"accessMode":{
17+
"title": "Access Mode",
18+
"type": "string",
19+
"enum": ["Read Only", "Read/Write"],
20+
"default": "Read Only"
2121
}
2222
}
2323
}

src/ls/driver.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ export default class DuckDBDriver extends AbstractDriver<DriverLib, DriverOption
3030
return this.connection;
3131
}
3232
try {
33-
// const mode = this.credentials.databaseFilePath !== ':memory:' ? OPEN_READONLY : OPEN_READWRITE;
3433
var mode = null;
3534

36-
if( this.credentials.readWrite || this.credentials.databaseFilePath === ':memory:') {
35+
if( this.credentials.accessMode === "Read/Write" || this.credentials.databaseFilePath === ':memory:') {
3736
mode = OPEN_READWRITE;
3837
} else {
3938
mode = OPEN_READONLY;
@@ -61,7 +60,7 @@ export default class DuckDBDriver extends AbstractDriver<DriverLib, DriverOption
6160
const rows = await db.all(query.toString());
6261
var messages = [];
6362
if (rows.length === 0) {
64-
messages = ['Query executed successfully with, no results were returned.'];
63+
messages = ['Query executed successfully, no results returned.'];
6564
}
6665
else {
6766
messages = ["Successfully returned " + rows.length + " rows." ];

ui.schema.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
22
"ui:order": ["database"],
3-
"databaseFilePath": { "ui:widget": "file" }
3+
"databaseFilePath": { "ui:widget": "file" },
4+
"accessMode": {
5+
"ui:help": "Warning: Read/Write connections prevent any other connections until they are closed"
6+
}
7+
48
}

0 commit comments

Comments
 (0)