@malloydata/db-trino 0.0.433 → 0.0.435
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.
|
@@ -86,6 +86,9 @@ function convertArray(elementType, raw, unpack) {
|
|
|
86
86
|
* for rowDataToDate to handle downstream
|
|
87
87
|
* - BIGINT precision is limited by the Trino JS client which
|
|
88
88
|
* delivers values as JS number (no bigint support)
|
|
89
|
+
* - A value the driver has already decoded past the scalar kinds (a map,
|
|
90
|
+
* a JSON document) belongs to a `sql native` field and is handed on as
|
|
91
|
+
* it came
|
|
89
92
|
*/
|
|
90
93
|
function convertScalar(typeDef, raw) {
|
|
91
94
|
if (raw === null || raw === undefined)
|
|
@@ -113,11 +116,6 @@ function convertScalar(typeDef, raw) {
|
|
|
113
116
|
// Plain timestamps: Trino returns UTC values
|
|
114
117
|
return new Date(raw + 'Z');
|
|
115
118
|
}
|
|
116
|
-
|
|
117
|
-
typeof raw === 'number' ||
|
|
118
|
-
typeof raw === 'boolean') {
|
|
119
|
-
return raw;
|
|
120
|
-
}
|
|
121
|
-
return null;
|
|
119
|
+
return raw;
|
|
122
120
|
}
|
|
123
121
|
//# sourceMappingURL=result-to-querydata.js.map
|
package/dist/test.nonspec.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/*import {Trino, BasicAuth} from 'trino-client';
|
|
3
|
+
/*import {Trino, BasicAuth} from '@trinodb/trino-js-client';
|
|
4
4
|
import PrestoClient from '@prestodb/presto-js-client';
|
|
5
5
|
|
|
6
6
|
// function CallPresto(client: Client, query: string ) {
|
package/dist/trino_connection.js
CHANGED
|
@@ -10,7 +10,7 @@ const internal_1 = require("@malloydata/malloy/internal");
|
|
|
10
10
|
const connection_1 = require("@malloydata/malloy/connection");
|
|
11
11
|
const presto_js_client_1 = require("@prestodb/presto-js-client");
|
|
12
12
|
const crypto_1 = require("crypto");
|
|
13
|
-
const
|
|
13
|
+
const trino_js_client_1 = require("@trinodb/trino-js-client");
|
|
14
14
|
const result_to_querydata_1 = require("./result-to-querydata");
|
|
15
15
|
class PrestoRunner {
|
|
16
16
|
constructor(config) {
|
|
@@ -58,7 +58,7 @@ class PrestoRunner {
|
|
|
58
58
|
class TrinoRunner {
|
|
59
59
|
constructor(config) {
|
|
60
60
|
let server = config.server;
|
|
61
|
-
//
|
|
61
|
+
// the client has no separate port field — merge into the server URL
|
|
62
62
|
if (server && config.port) {
|
|
63
63
|
try {
|
|
64
64
|
const url = new URL(server);
|
|
@@ -71,13 +71,13 @@ class TrinoRunner {
|
|
|
71
71
|
// If server isn't a parseable URL, leave it as-is
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
this.client =
|
|
74
|
+
this.client = trino_js_client_1.Trino.create({
|
|
75
75
|
...config.extraConfig,
|
|
76
76
|
source: config.source,
|
|
77
77
|
catalog: config.catalog,
|
|
78
78
|
server,
|
|
79
79
|
schema: config.schema,
|
|
80
|
-
auth: new
|
|
80
|
+
auth: new trino_js_client_1.BasicAuth(config.user, config.password || ''),
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
async runSQL(sql, options = {}, queryMetadataComment = '') {
|
|
@@ -247,10 +247,13 @@ class TrinoPrestoConnection extends connection_1.BaseConnection {
|
|
|
247
247
|
throw new Error(queryResult.error);
|
|
248
248
|
}
|
|
249
249
|
const rows = (_a = queryResult.rows) !== null && _a !== void 0 ? _a : [];
|
|
250
|
+
if (rows.length === 0) {
|
|
251
|
+
throw new Error('DESCRIBE returned no columns');
|
|
252
|
+
}
|
|
250
253
|
this.structDefFromSchema(rows, structDef);
|
|
251
254
|
}
|
|
252
255
|
catch (e) {
|
|
253
|
-
throw new Error(`Could not fetch schema for ${element} ${e instanceof Error ? e.message : e}`);
|
|
256
|
+
throw new Error(`Could not fetch schema for ${element}: ${e instanceof Error ? e.message : e}`);
|
|
254
257
|
}
|
|
255
258
|
return structDef;
|
|
256
259
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/db-trino",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.435",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"lint": "eslint '**/*.ts{,x}'",
|
|
17
17
|
"lint-fix": "eslint '**/*.ts{,x}' --fix",
|
|
18
|
-
"test": "jest
|
|
18
|
+
"test": "cd ../.. && ts-node scripts/check_dialect_connection.ts trino presto && jest packages/malloy-db-trino",
|
|
19
19
|
"build": "tsc --build",
|
|
20
20
|
"dev": "tsc --build",
|
|
21
21
|
"clean": "tsc --build --clean && rm -f tsconfig.tsbuildinfo",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"prepublishOnly": "npm run build"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@malloydata/malloy": "0.0.
|
|
26
|
+
"@malloydata/malloy": "0.0.435",
|
|
27
27
|
"@prestodb/presto-js-client": "^1.1.0",
|
|
28
|
+
"@trinodb/trino-js-client": "0.3.2",
|
|
28
29
|
"gaxios": "^4.2.0",
|
|
29
|
-
"luxon": "^3.7.2"
|
|
30
|
-
"trino-client": "^0.2.2"
|
|
30
|
+
"luxon": "^3.7.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/luxon": "^3.7.2"
|