@malloydata/db-duckdb 0.0.391 → 0.0.392
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_common.js +11 -3
- package/package.json +3 -2
package/dist/duckdb_common.js
CHANGED
|
@@ -32,6 +32,14 @@ const unquoteName = (name) => {
|
|
|
32
32
|
}
|
|
33
33
|
return name;
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* A bare or schema-qualified SQL identifier — `name` or `schema.name`. Anything
|
|
37
|
+
* else (file paths with dashes, dots-as-extensions, slashes, URL schemes,
|
|
38
|
+
* globs) is treated as a file-path string by `fetchTableSchema` and wrapped
|
|
39
|
+
* in single quotes so DuckDB sees it as a string literal rather than parsing
|
|
40
|
+
* it as a SQL identifier.
|
|
41
|
+
*/
|
|
42
|
+
const SQL_IDENTIFIER_CHAIN = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/;
|
|
35
43
|
class DuckDBCommon extends connection_1.BaseConnection {
|
|
36
44
|
get dialectName() {
|
|
37
45
|
return this.dialect.name;
|
|
@@ -123,9 +131,9 @@ class DuckDBCommon extends connection_1.BaseConnection {
|
|
|
123
131
|
connection: this.name,
|
|
124
132
|
fields: [],
|
|
125
133
|
};
|
|
126
|
-
const quotedTablePath =
|
|
127
|
-
?
|
|
128
|
-
: tablePath
|
|
134
|
+
const quotedTablePath = SQL_IDENTIFIER_CHAIN.test(tablePath)
|
|
135
|
+
? tablePath
|
|
136
|
+
: `'${tablePath}'`;
|
|
129
137
|
const infoQuery = `DESCRIBE SELECT * FROM ${quotedTablePath}`;
|
|
130
138
|
await this.schemaFromQuery(infoQuery, structDef);
|
|
131
139
|
return structDef;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/db-duckdb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.392",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"lint-fix": "eslint '**/*.ts{,x}' --fix",
|
|
54
54
|
"test": "jest --config=../../jest.config.js",
|
|
55
55
|
"build": "tsc --build",
|
|
56
|
+
"dev": "tsc --build",
|
|
56
57
|
"clean": "tsc --build --clean && rm -f tsconfig.tsbuildinfo",
|
|
57
58
|
"malloyc": "ts-node ../../scripts/malloy-to-json",
|
|
58
59
|
"prepublishOnly": "npm run build"
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"dependencies": {
|
|
61
62
|
"@duckdb/duckdb-wasm": "1.33.1-dev13.0",
|
|
62
63
|
"@duckdb/node-api": "1.4.4-r.1",
|
|
63
|
-
"@malloydata/malloy": "0.0.
|
|
64
|
+
"@malloydata/malloy": "0.0.392",
|
|
64
65
|
"@motherduck/wasm-client": "^0.6.6",
|
|
65
66
|
"apache-arrow": "^17.0.0",
|
|
66
67
|
"web-worker": "^1.3.0"
|