@malloydata/db-duckdb 0.0.123-dev240209165819 → 0.0.123-dev240209222024
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/duckdb_connection.js +29 -12
- package/package.json +2 -2
|
@@ -80,25 +80,42 @@ class DuckDBConnection extends duckdb_common_1.DuckDBCommon {
|
|
|
80
80
|
let activeDB;
|
|
81
81
|
if (this.databasePath in DuckDBConnection.activeDBs) {
|
|
82
82
|
activeDB = DuckDBConnection.activeDBs[this.databasePath];
|
|
83
|
+
this.connection = activeDB.database.connect();
|
|
84
|
+
activeDB.connections.push(this.connection);
|
|
85
|
+
resolve();
|
|
83
86
|
}
|
|
84
87
|
else {
|
|
85
|
-
if (this.
|
|
86
|
-
|
|
88
|
+
if (this.databasePath.startsWith('md:')) {
|
|
89
|
+
if (this.motherDuckToken) {
|
|
90
|
+
process.env['MOTHERDUCK_TOKEN'] = this.motherDuckToken;
|
|
91
|
+
}
|
|
92
|
+
if (!process.env['MOTHERDUCK_TOKEN']) {
|
|
93
|
+
const err = new Error('Please set your MotherDuck Token');
|
|
94
|
+
this.setup = async () => {
|
|
95
|
+
throw err;
|
|
96
|
+
};
|
|
97
|
+
return reject(err);
|
|
98
|
+
}
|
|
87
99
|
}
|
|
88
100
|
const database = new duckdb_1.Database(this.databasePath, this.readOnly ? duckdb_1.OPEN_READONLY : duckdb_1.OPEN_READWRITE, err => {
|
|
89
101
|
if (err) {
|
|
102
|
+
this.setup = async () => {
|
|
103
|
+
throw err;
|
|
104
|
+
};
|
|
90
105
|
reject(err);
|
|
91
106
|
}
|
|
107
|
+
else {
|
|
108
|
+
activeDB = {
|
|
109
|
+
database,
|
|
110
|
+
connections: [],
|
|
111
|
+
};
|
|
112
|
+
DuckDBConnection.activeDBs[this.databasePath] = activeDB;
|
|
113
|
+
this.connection = activeDB.database.connect();
|
|
114
|
+
activeDB.connections.push(this.connection);
|
|
115
|
+
resolve();
|
|
116
|
+
}
|
|
92
117
|
});
|
|
93
|
-
|
|
94
|
-
database,
|
|
95
|
-
connections: [],
|
|
96
|
-
};
|
|
97
|
-
DuckDBConnection.activeDBs[this.databasePath] = activeDB;
|
|
98
|
-
}
|
|
99
|
-
this.connection = activeDB.database.connect();
|
|
100
|
-
activeDB.connections.push(this.connection);
|
|
101
|
-
resolve();
|
|
118
|
+
}
|
|
102
119
|
});
|
|
103
120
|
}
|
|
104
121
|
async loadExtension(ext) {
|
|
@@ -122,7 +139,7 @@ class DuckDBConnection extends duckdb_common_1.DuckDBCommon {
|
|
|
122
139
|
'icu',
|
|
123
140
|
...this.additionalExtensions,
|
|
124
141
|
];
|
|
125
|
-
if (this.
|
|
142
|
+
if (this.databasePath.startsWith('md:')) {
|
|
126
143
|
extensions.push('motherduck');
|
|
127
144
|
}
|
|
128
145
|
for (const ext of extensions) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/db-duckdb",
|
|
3
|
-
"version": "0.0.123-
|
|
3
|
+
"version": "0.0.123-dev240209222024",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@malloydata/duckdb-wasm": "0.0.6",
|
|
44
|
-
"@malloydata/malloy": "^0.0.123-
|
|
44
|
+
"@malloydata/malloy": "^0.0.123-dev240209222024",
|
|
45
45
|
"apache-arrow": "^13.0.0",
|
|
46
46
|
"duckdb": "0.9.2",
|
|
47
47
|
"web-worker": "^1.2.0"
|