@malloydata/db-duckdb 0.0.26-dev230308225919 → 0.0.26-dev230309222349
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_wasm_connection.js +19 -10
- package/package.json +2 -2
|
@@ -202,24 +202,33 @@ class DuckDBWASMConnection extends duckdb_common_1.DuckDBCommon {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
async fetchSchemaForTables(tables) {
|
|
205
|
-
|
|
205
|
+
const fetchRemoteFile = async (tablePath) => {
|
|
206
|
+
var _a;
|
|
207
|
+
for (const callback of this.remoteFileCallbacks) {
|
|
208
|
+
const data = await callback(tablePath);
|
|
209
|
+
if (data) {
|
|
210
|
+
await ((_a = this.database) === null || _a === void 0 ? void 0 : _a.registerFileBuffer(tablePath, data));
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return true;
|
|
215
|
+
};
|
|
206
216
|
await this.setup();
|
|
207
217
|
for (const tableUri of tables) {
|
|
208
218
|
const { tablePath } = (0, malloy_1.parseTableURI)(tableUri);
|
|
219
|
+
// http and s3 urls are handled by duckdb-wasm
|
|
209
220
|
if (tablePath.match(/^https?:\/\//)) {
|
|
210
221
|
continue;
|
|
211
222
|
}
|
|
212
|
-
if (
|
|
223
|
+
if (tablePath.match(/^s3:\/\//)) {
|
|
213
224
|
continue;
|
|
214
225
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (data) {
|
|
219
|
-
await ((_a = this.database) === null || _a === void 0 ? void 0 : _a.registerFileBuffer(tablePath, data));
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
226
|
+
// If we're not trying to fetch start trying
|
|
227
|
+
if (!(tablePath in this.remoteFileStatus)) {
|
|
228
|
+
this.remoteFileStatus[tablePath] = fetchRemoteFile(tablePath);
|
|
222
229
|
}
|
|
230
|
+
// Wait for response
|
|
231
|
+
await this.remoteFileStatus[tablePath];
|
|
223
232
|
}
|
|
224
233
|
return super.fetchSchemaForTables(tables);
|
|
225
234
|
}
|
|
@@ -242,7 +251,7 @@ class DuckDBWASMConnection extends duckdb_common_1.DuckDBCommon {
|
|
|
242
251
|
}
|
|
243
252
|
async registerRemoteTable(tableName, url) {
|
|
244
253
|
var _a;
|
|
245
|
-
this.remoteFileStatus[tableName] = true;
|
|
254
|
+
this.remoteFileStatus[tableName] = Promise.resolve(true);
|
|
246
255
|
(_a = this.database) === null || _a === void 0 ? void 0 : _a.registerFileURL(tableName, url, duckdb.DuckDBDataProtocol.HTTP, true);
|
|
247
256
|
}
|
|
248
257
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/db-duckdb",
|
|
3
|
-
"version": "0.0.26-
|
|
3
|
+
"version": "0.0.26-dev230309222349",
|
|
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
|
"@duckdb/duckdb-wasm": "1.24.0",
|
|
44
|
-
"@malloydata/malloy": "^0.0.26-
|
|
44
|
+
"@malloydata/malloy": "^0.0.26-dev230309222349",
|
|
45
45
|
"apache-arrow": "^11.0.0",
|
|
46
46
|
"duckdb": "0.7.1",
|
|
47
47
|
"web-worker": "^1.2.0"
|