@malloydata/db-duckdb 0.0.123 → 0.0.124-dev240210014322
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.
|
@@ -21,6 +21,7 @@ export declare class DuckDBConnection extends DuckDBCommon {
|
|
|
21
21
|
private readOnly;
|
|
22
22
|
connecting: Promise<void>;
|
|
23
23
|
protected connection: Connection | null;
|
|
24
|
+
protected setupError: Error | undefined;
|
|
24
25
|
protected isSetup: Promise<void> | undefined;
|
|
25
26
|
static activeDBs: Record<string, ActiveDB>;
|
|
26
27
|
constructor(options: DuckDBConnectionOptions, queryOptions?: QueryOptionsReader);
|
|
@@ -76,7 +76,7 @@ class DuckDBConnection extends duckdb_common_1.DuckDBCommon {
|
|
|
76
76
|
this.connecting = this.init();
|
|
77
77
|
}
|
|
78
78
|
async init() {
|
|
79
|
-
return new Promise(
|
|
79
|
+
return new Promise(resolve => {
|
|
80
80
|
let activeDB;
|
|
81
81
|
if (this.databasePath in DuckDBConnection.activeDBs) {
|
|
82
82
|
activeDB = DuckDBConnection.activeDBs[this.databasePath];
|
|
@@ -90,19 +90,13 @@ class DuckDBConnection extends duckdb_common_1.DuckDBCommon {
|
|
|
90
90
|
process.env['MOTHERDUCK_TOKEN'] = this.motherDuckToken;
|
|
91
91
|
}
|
|
92
92
|
if (!process.env['MOTHERDUCK_TOKEN']) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
throw err;
|
|
96
|
-
};
|
|
97
|
-
return reject(err);
|
|
93
|
+
this.setupError = new Error('Please set your MotherDuck Token');
|
|
94
|
+
return resolve();
|
|
98
95
|
}
|
|
99
96
|
}
|
|
100
97
|
const database = new duckdb_1.Database(this.databasePath, this.readOnly ? duckdb_1.OPEN_READONLY : duckdb_1.OPEN_READWRITE, err => {
|
|
101
98
|
if (err) {
|
|
102
|
-
this.
|
|
103
|
-
throw err;
|
|
104
|
-
};
|
|
105
|
-
reject(err);
|
|
99
|
+
this.setupError = err;
|
|
106
100
|
}
|
|
107
101
|
else {
|
|
108
102
|
activeDB = {
|
|
@@ -112,8 +106,8 @@ class DuckDBConnection extends duckdb_common_1.DuckDBCommon {
|
|
|
112
106
|
DuckDBConnection.activeDBs[this.databasePath] = activeDB;
|
|
113
107
|
this.connection = activeDB.database.connect();
|
|
114
108
|
activeDB.connections.push(this.connection);
|
|
115
|
-
resolve();
|
|
116
109
|
}
|
|
110
|
+
resolve();
|
|
117
111
|
});
|
|
118
112
|
}
|
|
119
113
|
});
|
|
@@ -129,6 +123,9 @@ class DuckDBConnection extends duckdb_common_1.DuckDBCommon {
|
|
|
129
123
|
}
|
|
130
124
|
}
|
|
131
125
|
async setup() {
|
|
126
|
+
if (this.setupError) {
|
|
127
|
+
throw this.setupError;
|
|
128
|
+
}
|
|
132
129
|
const doSetup = async () => {
|
|
133
130
|
if (this.workingDirectory) {
|
|
134
131
|
await this.runDuckDBQuery(`SET FILE_SEARCH_PATH='${this.workingDirectory}'`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/db-duckdb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.124-dev240210014322",
|
|
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.
|
|
44
|
+
"@malloydata/malloy": "^0.0.124-dev240210014322",
|
|
45
45
|
"apache-arrow": "^13.0.0",
|
|
46
46
|
"duckdb": "0.9.2",
|
|
47
47
|
"web-worker": "^1.2.0"
|