@lightdash/warehouses 2.228.1 → 2.229.0
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/.tsbuildinfo.build +1 -0
- package/package.json +4 -4
- package/dist/.tsbuildinfo +0 -1
- package/dist/ssh/sshTunnelFailure.test.d.ts +0 -2
- package/dist/ssh/sshTunnelFailure.test.d.ts.map +0 -1
- package/dist/ssh/sshTunnelFailure.test.js +0 -90
- package/dist/validateWarehouseColumnReferences.test.d.ts +0 -2
- package/dist/validateWarehouseColumnReferences.test.d.ts.map +0 -1
- package/dist/validateWarehouseColumnReferences.test.js +0 -168
- package/dist/warehouseClients/AthenaWarehouseClient.test.d.ts +0 -2
- package/dist/warehouseClients/AthenaWarehouseClient.test.d.ts.map +0 -1
- package/dist/warehouseClients/AthenaWarehouseClient.test.js +0 -261
- package/dist/warehouseClients/BigqueryWarehouseClient.mock.d.ts +0 -83
- package/dist/warehouseClients/BigqueryWarehouseClient.mock.d.ts.map +0 -1
- package/dist/warehouseClients/BigqueryWarehouseClient.mock.js +0 -130
- package/dist/warehouseClients/BigqueryWarehouseClient.test.d.ts +0 -2
- package/dist/warehouseClients/BigqueryWarehouseClient.test.d.ts.map +0 -1
- package/dist/warehouseClients/BigqueryWarehouseClient.test.js +0 -493
- package/dist/warehouseClients/ClickhouseWarehouseClient.test.d.ts +0 -2
- package/dist/warehouseClients/ClickhouseWarehouseClient.test.d.ts.map +0 -1
- package/dist/warehouseClients/ClickhouseWarehouseClient.test.js +0 -115
- package/dist/warehouseClients/DatabricksWarehouseClient.mock.d.ts +0 -17
- package/dist/warehouseClients/DatabricksWarehouseClient.mock.d.ts.map +0 -1
- package/dist/warehouseClients/DatabricksWarehouseClient.mock.js +0 -111
- package/dist/warehouseClients/DatabricksWarehouseClient.test.d.ts +0 -2
- package/dist/warehouseClients/DatabricksWarehouseClient.test.d.ts.map +0 -1
- package/dist/warehouseClients/DatabricksWarehouseClient.test.js +0 -592
- package/dist/warehouseClients/DatabricksWarehouseStartupRetry.test.d.ts +0 -2
- package/dist/warehouseClients/DatabricksWarehouseStartupRetry.test.d.ts.map +0 -1
- package/dist/warehouseClients/DatabricksWarehouseStartupRetry.test.js +0 -129
- package/dist/warehouseClients/DuckdbWarehouseClient.embedded.test.d.ts +0 -2
- package/dist/warehouseClients/DuckdbWarehouseClient.embedded.test.d.ts.map +0 -1
- package/dist/warehouseClients/DuckdbWarehouseClient.embedded.test.js +0 -92
- package/dist/warehouseClients/DuckdbWarehouseClient.test.d.ts +0 -2
- package/dist/warehouseClients/DuckdbWarehouseClient.test.d.ts.map +0 -1
- package/dist/warehouseClients/DuckdbWarehouseClient.test.js +0 -1749
- package/dist/warehouseClients/MotherduckErrorClassifier.test.d.ts +0 -2
- package/dist/warehouseClients/MotherduckErrorClassifier.test.d.ts.map +0 -1
- package/dist/warehouseClients/MotherduckErrorClassifier.test.js +0 -31
- package/dist/warehouseClients/MotherduckInstanceCache.catalog.test.d.ts +0 -2
- package/dist/warehouseClients/MotherduckInstanceCache.catalog.test.d.ts.map +0 -1
- package/dist/warehouseClients/MotherduckInstanceCache.catalog.test.js +0 -52
- package/dist/warehouseClients/MotherduckInstanceCache.integration.test.d.ts +0 -2
- package/dist/warehouseClients/MotherduckInstanceCache.integration.test.d.ts.map +0 -1
- package/dist/warehouseClients/MotherduckInstanceCache.integration.test.js +0 -172
- package/dist/warehouseClients/MotherduckInstanceCache.security.test.d.ts +0 -2
- package/dist/warehouseClients/MotherduckInstanceCache.security.test.d.ts.map +0 -1
- package/dist/warehouseClients/MotherduckInstanceCache.security.test.js +0 -192
- package/dist/warehouseClients/MotherduckInstanceCache.test.d.ts +0 -2
- package/dist/warehouseClients/MotherduckInstanceCache.test.d.ts.map +0 -1
- package/dist/warehouseClients/MotherduckInstanceCache.test.js +0 -302
- package/dist/warehouseClients/PostgresWarehouseClient.mock.d.ts +0 -8
- package/dist/warehouseClients/PostgresWarehouseClient.mock.d.ts.map +0 -1
- package/dist/warehouseClients/PostgresWarehouseClient.mock.js +0 -66
- package/dist/warehouseClients/PostgresWarehouseClient.test.d.ts +0 -2
- package/dist/warehouseClients/PostgresWarehouseClient.test.d.ts.map +0 -1
- package/dist/warehouseClients/PostgresWarehouseClient.test.js +0 -371
- package/dist/warehouseClients/RedshiftWarehouseClient.test.d.ts +0 -2
- package/dist/warehouseClients/RedshiftWarehouseClient.test.d.ts.map +0 -1
- package/dist/warehouseClients/RedshiftWarehouseClient.test.js +0 -126
- package/dist/warehouseClients/SnowflakeWarehouseClient.mock.d.ts +0 -41
- package/dist/warehouseClients/SnowflakeWarehouseClient.mock.d.ts.map +0 -1
- package/dist/warehouseClients/SnowflakeWarehouseClient.mock.js +0 -184
- package/dist/warehouseClients/SnowflakeWarehouseClient.test.d.ts +0 -2
- package/dist/warehouseClients/SnowflakeWarehouseClient.test.d.ts.map +0 -1
- package/dist/warehouseClients/SnowflakeWarehouseClient.test.js +0 -777
- package/dist/warehouseClients/TrinoWarehouseClient.mock.d.ts +0 -23
- package/dist/warehouseClients/TrinoWarehouseClient.mock.d.ts.map +0 -1
- package/dist/warehouseClients/TrinoWarehouseClient.mock.js +0 -102
- package/dist/warehouseClients/TrinoWarehouseClient.test.d.ts +0 -2
- package/dist/warehouseClients/TrinoWarehouseClient.test.d.ts.map +0 -1
- package/dist/warehouseClients/TrinoWarehouseClient.test.js +0 -230
- package/dist/warehouseClients/WarehouseClient.mock.d.ts +0 -13
- package/dist/warehouseClients/WarehouseClient.mock.d.ts.map +0 -1
- package/dist/warehouseClients/WarehouseClient.mock.js +0 -51
- package/dist/warehouseClients/numericKinds.test.d.ts +0 -2
- package/dist/warehouseClients/numericKinds.test.d.ts.map +0 -1
- package/dist/warehouseClients/numericKinds.test.js +0 -168
- package/dist/warehouseClients/pgProtocolGuard.integration.test.d.ts +0 -2
- package/dist/warehouseClients/pgProtocolGuard.integration.test.d.ts.map +0 -1
- package/dist/warehouseClients/pgProtocolGuard.integration.test.js +0 -93
- package/dist/warehouseClients/pgProtocolGuard.test.d.ts +0 -2
- package/dist/warehouseClients/pgProtocolGuard.test.d.ts.map +0 -1
- package/dist/warehouseClients/pgProtocolGuard.test.js +0 -48
- package/dist/warehouseClients/redshiftIamCredentials.test.d.ts +0 -2
- package/dist/warehouseClients/redshiftIamCredentials.test.d.ts.map +0 -1
- package/dist/warehouseClients/redshiftIamCredentials.test.js +0 -210
- package/dist/warehouseClients/timestampDomain.test.d.ts +0 -2
- package/dist/warehouseClients/timestampDomain.test.d.ts.map +0 -1
- package/dist/warehouseClients/timestampDomain.test.js +0 -101
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CreateTrinoCredentials } from '@lightdash/common';
|
|
2
|
-
export declare const credentials: CreateTrinoCredentials;
|
|
3
|
-
export declare const queryResponse: {
|
|
4
|
-
columns: {
|
|
5
|
-
name: string;
|
|
6
|
-
type: string;
|
|
7
|
-
typeSignature: {
|
|
8
|
-
rawType: string;
|
|
9
|
-
};
|
|
10
|
-
}[];
|
|
11
|
-
data: (string | number | boolean | Date)[][];
|
|
12
|
-
};
|
|
13
|
-
export declare const querySchemaResponse: {
|
|
14
|
-
columns: {
|
|
15
|
-
name: string;
|
|
16
|
-
type: string;
|
|
17
|
-
typeSignature: {
|
|
18
|
-
rawType: string;
|
|
19
|
-
};
|
|
20
|
-
}[];
|
|
21
|
-
data: string[][];
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=TrinoWarehouseClient.mock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TrinoWarehouseClient.mock.d.ts","sourceRoot":"","sources":["../../src/warehouseClients/TrinoWarehouseClient.mock.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EAGzB,MAAM,mBAAmB,CAAC;AAI3B,eAAO,MAAM,WAAW,EAAE,sBASzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;YAKG,OAAO;;;;CA4CnC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;YAKH,OAAO;;;;CAgCnC,CAAC"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.querySchemaResponse = exports.queryResponse = exports.credentials = void 0;
|
|
4
|
-
const common_1 = require("@lightdash/common");
|
|
5
|
-
exports.credentials = {
|
|
6
|
-
type: common_1.WarehouseTypes.TRINO,
|
|
7
|
-
host: '',
|
|
8
|
-
user: '',
|
|
9
|
-
password: '',
|
|
10
|
-
port: 443,
|
|
11
|
-
dbname: '',
|
|
12
|
-
schema: '',
|
|
13
|
-
http_scheme: '',
|
|
14
|
-
};
|
|
15
|
-
exports.queryResponse = {
|
|
16
|
-
columns: [
|
|
17
|
-
{
|
|
18
|
-
name: 'mystringcolumn',
|
|
19
|
-
type: 'varchar',
|
|
20
|
-
typeSignature: { rawType: 'varchar' },
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: 'mynumbercolumn',
|
|
24
|
-
type: 'integer',
|
|
25
|
-
typeSignature: { rawType: 'integer' },
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: 'mydatecolumn',
|
|
29
|
-
type: 'date',
|
|
30
|
-
typeSignature: { rawType: 'date' },
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: 'mytimestampcolumn',
|
|
34
|
-
type: 'timestamp',
|
|
35
|
-
typeSignature: { rawType: 'timestamp' },
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: 'mybooleancolumn',
|
|
39
|
-
type: 'boolean',
|
|
40
|
-
typeSignature: { rawType: 'boolean' },
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: 'myarraycolumn',
|
|
44
|
-
type: 'array',
|
|
45
|
-
typeSignature: { rawType: 'array' },
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'myobjectcolumn',
|
|
49
|
-
type: 'json',
|
|
50
|
-
typeSignature: { rawType: 'json' },
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
data: [
|
|
54
|
-
[
|
|
55
|
-
'string value',
|
|
56
|
-
100,
|
|
57
|
-
new Date('2021-03-10T00:00:00.000Z'),
|
|
58
|
-
new Date('1990-03-02T08:30:00.010Z'),
|
|
59
|
-
false,
|
|
60
|
-
'1,2,3',
|
|
61
|
-
'[object Object]',
|
|
62
|
-
],
|
|
63
|
-
],
|
|
64
|
-
};
|
|
65
|
-
exports.querySchemaResponse = {
|
|
66
|
-
columns: [
|
|
67
|
-
{
|
|
68
|
-
name: 'table_catalog',
|
|
69
|
-
type: 'varchar',
|
|
70
|
-
typeSignature: { rawType: 'varchar' },
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'table_schema',
|
|
74
|
-
type: 'varchar',
|
|
75
|
-
typeSignature: { rawType: 'varchar' },
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: 'table_name',
|
|
79
|
-
type: 'varchar',
|
|
80
|
-
typeSignature: { rawType: 'varchar' },
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: 'columns_name',
|
|
84
|
-
type: 'varchar',
|
|
85
|
-
typeSignature: { rawType: 'varchar' },
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: 'data_type',
|
|
89
|
-
type: 'varchar',
|
|
90
|
-
typeSignature: { rawType: 'varchar' },
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
data: [
|
|
94
|
-
['myDatabase', 'mySchema', 'myTable', 'myStringColumn', 'varchar'],
|
|
95
|
-
['myDatabase', 'mySchema', 'myTable', 'myNumberColumn', 'integer'],
|
|
96
|
-
['myDatabase', 'mySchema', 'myTable', 'myDateColumn', 'date'],
|
|
97
|
-
['myDatabase', 'mySchema', 'myTable', 'myTimestampColumn', 'timestamp'],
|
|
98
|
-
['myDatabase', 'mySchema', 'myTable', 'myBooleanColumn', 'boolean'],
|
|
99
|
-
['myDatabase', 'mySchema', 'myTable', 'myArrayColumn', 'array'],
|
|
100
|
-
['myDatabase', 'mySchema', 'myTable', 'myObjectColumn', 'json'],
|
|
101
|
-
],
|
|
102
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TrinoWarehouseClient.test.d.ts","sourceRoot":"","sources":["../../src/warehouseClients/TrinoWarehouseClient.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
/* eslint-disable @typescript-eslint/no-floating-promises */
|
|
37
|
-
const common_1 = require("@lightdash/common");
|
|
38
|
-
const TrinoWarehouseClient_1 = require("./TrinoWarehouseClient");
|
|
39
|
-
const TrinoWarehouseClient_mock_1 = require("./TrinoWarehouseClient.mock");
|
|
40
|
-
const warehouseClient = __importStar(require("./WarehouseClient.mock"));
|
|
41
|
-
const queryResultMock = vi.fn();
|
|
42
|
-
vi.mock('trino-client', () => ({
|
|
43
|
-
BasicAuth: vi.fn(),
|
|
44
|
-
Trino: {
|
|
45
|
-
create: vi.fn(() => Promise.resolve({
|
|
46
|
-
query: queryResultMock,
|
|
47
|
-
})),
|
|
48
|
-
},
|
|
49
|
-
}));
|
|
50
|
-
describe('TrinoWarehouseClient', () => {
|
|
51
|
-
const lowerCaseFields = Object.keys(warehouseClient.expectedFields).reduce((acc, key) => {
|
|
52
|
-
acc[key.toLowerCase()] = warehouseClient.expectedFields[key];
|
|
53
|
-
return acc;
|
|
54
|
-
}, {});
|
|
55
|
-
// The mock's number column is a Trino integer, which reports its kind
|
|
56
|
-
lowerCaseFields.mynumbercolumn = {
|
|
57
|
-
...lowerCaseFields.mynumbercolumn,
|
|
58
|
-
numericKind: { kind: 'integer' },
|
|
59
|
-
};
|
|
60
|
-
const lowerCaseRow = Object.keys(warehouseClient.expectedRow).reduce((acc, key) => {
|
|
61
|
-
acc[key.toLowerCase()] = warehouseClient.expectedRow[key];
|
|
62
|
-
return acc;
|
|
63
|
-
}, {});
|
|
64
|
-
it('expect query rows', async () => {
|
|
65
|
-
const warehouse = new TrinoWarehouseClient_1.TrinoWarehouseClient(TrinoWarehouseClient_mock_1.credentials);
|
|
66
|
-
queryResultMock.mockReturnValue({
|
|
67
|
-
next: vi
|
|
68
|
-
.fn()
|
|
69
|
-
.mockResolvedValue({ done: true, value: TrinoWarehouseClient_mock_1.queryResponse }),
|
|
70
|
-
});
|
|
71
|
-
const results = await warehouse.runQuery('fake sql');
|
|
72
|
-
expect(results.rows[0]).toEqual(lowerCaseRow);
|
|
73
|
-
expect(results.fields).toEqual(lowerCaseFields);
|
|
74
|
-
});
|
|
75
|
-
it('expect query has mutiple result chunks', async () => {
|
|
76
|
-
const warehouse = new TrinoWarehouseClient_1.TrinoWarehouseClient(TrinoWarehouseClient_mock_1.credentials);
|
|
77
|
-
queryResultMock.mockReturnValue({
|
|
78
|
-
next: vi
|
|
79
|
-
.fn()
|
|
80
|
-
// First chunk: has nextUri indicating more data available
|
|
81
|
-
.mockResolvedValueOnce({
|
|
82
|
-
done: false,
|
|
83
|
-
value: { ...TrinoWarehouseClient_mock_1.queryResponse, nextUri: 'http://trino/next' },
|
|
84
|
-
})
|
|
85
|
-
// Second chunk: no nextUri, query complete
|
|
86
|
-
.mockResolvedValueOnce({ done: true, value: TrinoWarehouseClient_mock_1.queryResponse }),
|
|
87
|
-
});
|
|
88
|
-
const results = await warehouse.runQuery('fake sql');
|
|
89
|
-
expect(results.rows[0]).toEqual(lowerCaseRow);
|
|
90
|
-
expect(results.fields).toEqual(lowerCaseFields);
|
|
91
|
-
expect(results.rows.length).toEqual(2);
|
|
92
|
-
});
|
|
93
|
-
it('expect schema with trino types mapped to dimension types', async () => {
|
|
94
|
-
const warehouse = new TrinoWarehouseClient_1.TrinoWarehouseClient(TrinoWarehouseClient_mock_1.credentials);
|
|
95
|
-
queryResultMock.mockReturnValue({
|
|
96
|
-
next: vi
|
|
97
|
-
.fn()
|
|
98
|
-
.mockResolvedValue({ done: true, value: TrinoWarehouseClient_mock_1.querySchemaResponse }),
|
|
99
|
-
});
|
|
100
|
-
await expect(warehouse.getCatalog(warehouseClient.config)).resolves.toEqual(warehouseClient.expectedWarehouseSchemaWithNaiveTimestamp);
|
|
101
|
-
});
|
|
102
|
-
it('maps decimal precision and scale to a numeric dimension', async () => {
|
|
103
|
-
const warehouse = new TrinoWarehouseClient_1.TrinoWarehouseClient(TrinoWarehouseClient_mock_1.credentials);
|
|
104
|
-
queryResultMock.mockReturnValue({
|
|
105
|
-
next: vi.fn().mockResolvedValue({
|
|
106
|
-
done: true,
|
|
107
|
-
value: {
|
|
108
|
-
...TrinoWarehouseClient_mock_1.querySchemaResponse,
|
|
109
|
-
data: [
|
|
110
|
-
[
|
|
111
|
-
'myDatabase',
|
|
112
|
-
'mySchema',
|
|
113
|
-
'myTable',
|
|
114
|
-
'myDecimalColumn',
|
|
115
|
-
'decimal(18,4)',
|
|
116
|
-
],
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
}),
|
|
120
|
-
});
|
|
121
|
-
const catalog = await warehouse.getCatalog(warehouseClient.config);
|
|
122
|
-
expect(catalog.myDatabase.mySchema.myTable.myDecimalColumn).toEqual(common_1.DimensionType.NUMBER);
|
|
123
|
-
});
|
|
124
|
-
describe('streamQuery client tag headers', () => {
|
|
125
|
-
it('sends X-Trino-Client-Tags header as comma-separated key=value pairs when tags are provided', async () => {
|
|
126
|
-
const warehouse = new TrinoWarehouseClient_1.TrinoWarehouseClient(TrinoWarehouseClient_mock_1.credentials);
|
|
127
|
-
queryResultMock.mockReturnValue({
|
|
128
|
-
next: vi
|
|
129
|
-
.fn()
|
|
130
|
-
.mockResolvedValue({ done: true, value: TrinoWarehouseClient_mock_1.queryResponse }),
|
|
131
|
-
});
|
|
132
|
-
await warehouse.runQuery('SELECT 1', {
|
|
133
|
-
dashboard_uuid: 'abc-123',
|
|
134
|
-
chart_uuid: 'def-456',
|
|
135
|
-
});
|
|
136
|
-
expect(queryResultMock).toHaveBeenCalledWith(expect.objectContaining({
|
|
137
|
-
extraHeaders: expect.objectContaining({
|
|
138
|
-
'X-Trino-Client-Tags': 'dashboard_uuid=abc-123,chart_uuid=def-456',
|
|
139
|
-
}),
|
|
140
|
-
}));
|
|
141
|
-
});
|
|
142
|
-
it('sanitizes tag values that are unsafe for the header', async () => {
|
|
143
|
-
const warehouse = new TrinoWarehouseClient_1.TrinoWarehouseClient(TrinoWarehouseClient_mock_1.credentials);
|
|
144
|
-
queryResultMock.mockReturnValue({
|
|
145
|
-
next: vi
|
|
146
|
-
.fn()
|
|
147
|
-
.mockResolvedValue({ done: true, value: TrinoWarehouseClient_mock_1.queryResponse }),
|
|
148
|
-
});
|
|
149
|
-
await warehouse.runQuery('SELECT 1', {
|
|
150
|
-
scheduler_name: 'Weekly report, EMEA 📊',
|
|
151
|
-
query_context: common_1.QueryExecutionContext.SCHEDULED_DELIVERY,
|
|
152
|
-
});
|
|
153
|
-
expect(queryResultMock).toHaveBeenCalledWith(expect.objectContaining({
|
|
154
|
-
extraHeaders: {
|
|
155
|
-
'X-Trino-Client-Tags': 'scheduler_name=Weekly_report__EMEA___,query_context=scheduledDelivery',
|
|
156
|
-
},
|
|
157
|
-
}));
|
|
158
|
-
});
|
|
159
|
-
it('coerces non-string tag values instead of throwing', async () => {
|
|
160
|
-
const warehouse = new TrinoWarehouseClient_1.TrinoWarehouseClient(TrinoWarehouseClient_mock_1.credentials);
|
|
161
|
-
queryResultMock.mockReturnValue({
|
|
162
|
-
next: vi
|
|
163
|
-
.fn()
|
|
164
|
-
.mockResolvedValue({ done: true, value: TrinoWarehouseClient_mock_1.queryResponse }),
|
|
165
|
-
});
|
|
166
|
-
// graphile-worker job ids arrive as BigInt at runtime despite the
|
|
167
|
-
// Record<string, string> type (global pg INT8 parser override)
|
|
168
|
-
await warehouse.runQuery('SELECT 1', {
|
|
169
|
-
job_id: BigInt(4482031),
|
|
170
|
-
query_context: common_1.QueryExecutionContext.SCHEDULED_GSHEETS_DASHBOARD,
|
|
171
|
-
});
|
|
172
|
-
expect(queryResultMock).toHaveBeenCalledWith(expect.objectContaining({
|
|
173
|
-
extraHeaders: {
|
|
174
|
-
'X-Trino-Client-Tags': 'job_id=4482031,query_context=scheduledGsheetsDashboard',
|
|
175
|
-
},
|
|
176
|
-
}));
|
|
177
|
-
});
|
|
178
|
-
it('sends query as plain string (no extraHeaders) when no tags are provided', async () => {
|
|
179
|
-
const warehouse = new TrinoWarehouseClient_1.TrinoWarehouseClient(TrinoWarehouseClient_mock_1.credentials);
|
|
180
|
-
queryResultMock.mockReturnValue({
|
|
181
|
-
next: vi
|
|
182
|
-
.fn()
|
|
183
|
-
.mockResolvedValue({ done: true, value: TrinoWarehouseClient_mock_1.queryResponse }),
|
|
184
|
-
});
|
|
185
|
-
await warehouse.runQuery('SELECT 1');
|
|
186
|
-
expect(queryResultMock).toHaveBeenCalledWith('SELECT 1');
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
describe('TrinoSqlBuilder temporal literals', () => {
|
|
191
|
-
// Trino rejects zone-suffixed strings cast to plain TIMESTAMP.
|
|
192
|
-
const builder = new TrinoWarehouseClient_1.TrinoSqlBuilder();
|
|
193
|
-
const epoch = new Date(0);
|
|
194
|
-
it('emits a zone-free TIMESTAMP literal', () => {
|
|
195
|
-
expect(builder.castToTimestamp(epoch)).toBe("TIMESTAMP '1970-01-01 00:00:00.000'");
|
|
196
|
-
});
|
|
197
|
-
it('emits a DATE literal', () => {
|
|
198
|
-
expect(builder.castToDate(epoch)).toBe("DATE '1970-01-01'");
|
|
199
|
-
});
|
|
200
|
-
it('reuses the plain TIMESTAMP literal for naive timestamps', () => {
|
|
201
|
-
expect(builder.castToNaiveTimestamp(epoch)).toBe("TIMESTAMP '1970-01-01 00:00:00.000'");
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
describe('TrinoWarehouseClient getAllTables', () => {
|
|
205
|
-
it('lists tables and views', async () => {
|
|
206
|
-
const warehouse = new TrinoWarehouseClient_1.TrinoWarehouseClient(TrinoWarehouseClient_mock_1.credentials);
|
|
207
|
-
const runQuery = vi.spyOn(warehouse, 'runQuery').mockResolvedValueOnce({
|
|
208
|
-
rows: [
|
|
209
|
-
{
|
|
210
|
-
table_catalog: 'hive',
|
|
211
|
-
table_schema: 'analytics',
|
|
212
|
-
table_name: 'orders_view',
|
|
213
|
-
table_type: 'VIEW',
|
|
214
|
-
},
|
|
215
|
-
],
|
|
216
|
-
fields: {},
|
|
217
|
-
});
|
|
218
|
-
const tables = await warehouse.getAllTables();
|
|
219
|
-
const [query] = runQuery.mock.calls[0];
|
|
220
|
-
expect(query).toContain("table_type IN ('BASE TABLE', 'VIEW')");
|
|
221
|
-
expect(tables).toEqual([
|
|
222
|
-
{
|
|
223
|
-
database: 'hive',
|
|
224
|
-
schema: 'analytics',
|
|
225
|
-
table: 'orders_view',
|
|
226
|
-
tableType: 'view',
|
|
227
|
-
},
|
|
228
|
-
]);
|
|
229
|
-
});
|
|
230
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AnyType } from '@lightdash/common';
|
|
2
|
-
import { WarehouseCatalog } from '../types';
|
|
3
|
-
export declare const config: {
|
|
4
|
-
database: string;
|
|
5
|
-
schema: string;
|
|
6
|
-
table: string;
|
|
7
|
-
}[];
|
|
8
|
-
export declare const expectedWarehouseSchema: WarehouseCatalog;
|
|
9
|
-
export declare const expectedWarehouseSchemaWithNaiveTimestamp: WarehouseCatalog;
|
|
10
|
-
export declare const expectedWarehouseSchemaWithAwareTimestamp: WarehouseCatalog;
|
|
11
|
-
export declare const expectedFields: Record<string, AnyType>;
|
|
12
|
-
export declare const expectedRow: Record<string, AnyType>;
|
|
13
|
-
//# sourceMappingURL=WarehouseClient.mock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WarehouseClient.mock.d.ts","sourceRoot":"","sources":["../../src/warehouseClients/WarehouseClient.mock.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EAIV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB,EAMA,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,gBAcrC,CAAC;AAiBF,eAAO,MAAM,yCAAyC,kBAChB,CAAC;AAEvC,eAAO,MAAM,yCAAyC,kBAChB,CAAC;AAEvC,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAQlD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAQ/C,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.expectedRow = exports.expectedFields = exports.expectedWarehouseSchemaWithAwareTimestamp = exports.expectedWarehouseSchemaWithNaiveTimestamp = exports.expectedWarehouseSchema = exports.config = void 0;
|
|
4
|
-
const common_1 = require("@lightdash/common");
|
|
5
|
-
exports.config = [
|
|
6
|
-
{
|
|
7
|
-
database: 'myDatabase',
|
|
8
|
-
schema: 'mySchema',
|
|
9
|
-
table: 'myTable',
|
|
10
|
-
},
|
|
11
|
-
];
|
|
12
|
-
exports.expectedWarehouseSchema = {
|
|
13
|
-
myDatabase: {
|
|
14
|
-
mySchema: {
|
|
15
|
-
myTable: {
|
|
16
|
-
myStringColumn: common_1.DimensionType.STRING,
|
|
17
|
-
myNumberColumn: common_1.DimensionType.NUMBER,
|
|
18
|
-
myDateColumn: common_1.DimensionType.DATE,
|
|
19
|
-
myTimestampColumn: common_1.DimensionType.TIMESTAMP,
|
|
20
|
-
myBooleanColumn: common_1.DimensionType.BOOLEAN,
|
|
21
|
-
myArrayColumn: common_1.DimensionType.STRING,
|
|
22
|
-
myObjectColumn: common_1.DimensionType.STRING,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
const schemaWithTimestampDomain = (timestampDomain) => {
|
|
28
|
-
const catalog = structuredClone(exports.expectedWarehouseSchema);
|
|
29
|
-
(0, common_1.setCatalogTimestampDomain)(catalog, 'myDatabase', 'mySchema', 'myTable', 'myTimestampColumn', timestampDomain);
|
|
30
|
-
return catalog;
|
|
31
|
-
};
|
|
32
|
-
exports.expectedWarehouseSchemaWithNaiveTimestamp = schemaWithTimestampDomain('naive');
|
|
33
|
-
exports.expectedWarehouseSchemaWithAwareTimestamp = schemaWithTimestampDomain('aware');
|
|
34
|
-
exports.expectedFields = {
|
|
35
|
-
myStringColumn: { type: common_1.DimensionType.STRING },
|
|
36
|
-
myNumberColumn: { type: common_1.DimensionType.NUMBER },
|
|
37
|
-
myDateColumn: { type: common_1.DimensionType.DATE },
|
|
38
|
-
myTimestampColumn: { type: common_1.DimensionType.TIMESTAMP },
|
|
39
|
-
myBooleanColumn: { type: common_1.DimensionType.BOOLEAN },
|
|
40
|
-
myArrayColumn: { type: common_1.DimensionType.STRING },
|
|
41
|
-
myObjectColumn: { type: common_1.DimensionType.STRING },
|
|
42
|
-
};
|
|
43
|
-
exports.expectedRow = {
|
|
44
|
-
myStringColumn: 'string value',
|
|
45
|
-
myNumberColumn: 100,
|
|
46
|
-
myDateColumn: new Date('2021-03-10T00:00:00.000Z'),
|
|
47
|
-
myTimestampColumn: new Date('1990-03-02T08:30:00.010Z'),
|
|
48
|
-
myBooleanColumn: false,
|
|
49
|
-
myArrayColumn: '1,2,3',
|
|
50
|
-
myObjectColumn: '[object Object]',
|
|
51
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"numericKinds.test.d.ts","sourceRoot":"","sources":["../../src/warehouseClients/numericKinds.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const TCLIService_types_1 = require("@databricks/sql/thrift/TCLIService_types");
|
|
4
|
-
const vitest_1 = require("vitest");
|
|
5
|
-
const AthenaWarehouseClient_1 = require("./AthenaWarehouseClient");
|
|
6
|
-
const BigqueryWarehouseClient_1 = require("./BigqueryWarehouseClient");
|
|
7
|
-
const ClickhouseWarehouseClient_1 = require("./ClickhouseWarehouseClient");
|
|
8
|
-
const DatabricksWarehouseClient_1 = require("./DatabricksWarehouseClient");
|
|
9
|
-
const SnowflakeWarehouseClient_1 = require("./SnowflakeWarehouseClient");
|
|
10
|
-
const TrinoWarehouseClient_1 = require("./TrinoWarehouseClient");
|
|
11
|
-
// The typed read binds a NUMBER column by the kind its driver reports; a
|
|
12
|
-
// column without one binds as DOUBLE and loses digits above 2^53
|
|
13
|
-
(0, vitest_1.describe)('numeric kinds reported by warehouse drivers', () => {
|
|
14
|
-
(0, vitest_1.describe)('Snowflake', () => {
|
|
15
|
-
(0, vitest_1.it)('reads NUMBER with scale 0 as an integer and with a scale as a decimal', () => {
|
|
16
|
-
(0, vitest_1.expect)((0, SnowflakeWarehouseClient_1.getSnowflakeNumericKind)('FIXED', 0)).toEqual({
|
|
17
|
-
kind: 'integer',
|
|
18
|
-
});
|
|
19
|
-
(0, vitest_1.expect)((0, SnowflakeWarehouseClient_1.getSnowflakeNumericKind)('NUMBER', 4)).toEqual({
|
|
20
|
-
kind: 'decimal',
|
|
21
|
-
scale: 4,
|
|
22
|
-
});
|
|
23
|
-
(0, vitest_1.expect)((0, SnowflakeWarehouseClient_1.getSnowflakeNumericKind)('fixed', 2)).toEqual({
|
|
24
|
-
kind: 'decimal',
|
|
25
|
-
scale: 2,
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
(0, vitest_1.it)('reads REAL as a float and reports nothing without a scale or for other types', () => {
|
|
29
|
-
(0, vitest_1.expect)((0, SnowflakeWarehouseClient_1.getSnowflakeNumericKind)('REAL', 0)).toEqual({
|
|
30
|
-
kind: 'float',
|
|
31
|
-
});
|
|
32
|
-
(0, vitest_1.expect)((0, SnowflakeWarehouseClient_1.getSnowflakeNumericKind)('FIXED', undefined)).toBeNull();
|
|
33
|
-
(0, vitest_1.expect)((0, SnowflakeWarehouseClient_1.getSnowflakeNumericKind)('TEXT', 0)).toBeNull();
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
(0, vitest_1.describe)('BigQuery', () => {
|
|
37
|
-
(0, vitest_1.it)('reads INT64 as an integer and FLOAT64 as a float', () => {
|
|
38
|
-
(0, vitest_1.expect)((0, BigqueryWarehouseClient_1.getBigqueryNumericKind)({ type: 'INTEGER' })).toEqual({
|
|
39
|
-
kind: 'integer',
|
|
40
|
-
});
|
|
41
|
-
(0, vitest_1.expect)((0, BigqueryWarehouseClient_1.getBigqueryNumericKind)({ type: 'INT64' })).toEqual({
|
|
42
|
-
kind: 'integer',
|
|
43
|
-
});
|
|
44
|
-
(0, vitest_1.expect)((0, BigqueryWarehouseClient_1.getBigqueryNumericKind)({ type: 'FLOAT64' })).toEqual({
|
|
45
|
-
kind: 'float',
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
(0, vitest_1.it)('reads NUMERIC at its declared scale, else at the default of 9', () => {
|
|
49
|
-
(0, vitest_1.expect)((0, BigqueryWarehouseClient_1.getBigqueryNumericKind)({ type: 'NUMERIC', scale: '2' })).toEqual({ kind: 'decimal', scale: 2 });
|
|
50
|
-
(0, vitest_1.expect)((0, BigqueryWarehouseClient_1.getBigqueryNumericKind)({ type: 'NUMERIC' })).toEqual({
|
|
51
|
-
kind: 'decimal',
|
|
52
|
-
scale: 9,
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
(0, vitest_1.it)('reads BIGNUMERIC only when its declared precision fits a DuckDB decimal', () => {
|
|
56
|
-
(0, vitest_1.expect)((0, BigqueryWarehouseClient_1.getBigqueryNumericKind)({
|
|
57
|
-
type: 'BIGNUMERIC',
|
|
58
|
-
precision: '30',
|
|
59
|
-
scale: '4',
|
|
60
|
-
})).toEqual({ kind: 'decimal', scale: 4 });
|
|
61
|
-
(0, vitest_1.expect)((0, BigqueryWarehouseClient_1.getBigqueryNumericKind)({ type: 'BIGNUMERIC' })).toBeNull();
|
|
62
|
-
(0, vitest_1.expect)((0, BigqueryWarehouseClient_1.getBigqueryNumericKind)({ type: 'BIGNUMERIC', scale: '4' })).toBeNull();
|
|
63
|
-
(0, vitest_1.expect)((0, BigqueryWarehouseClient_1.getBigqueryNumericKind)({
|
|
64
|
-
type: 'BIGNUMERIC',
|
|
65
|
-
precision: '60',
|
|
66
|
-
scale: '4',
|
|
67
|
-
})).toBeNull();
|
|
68
|
-
(0, vitest_1.expect)((0, BigqueryWarehouseClient_1.getBigqueryNumericKind)({ type: 'STRING' })).toBeNull();
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
(0, vitest_1.describe)('Trino', () => {
|
|
72
|
-
(0, vitest_1.it)('reads the kind and the decimal scale from the column type string', () => {
|
|
73
|
-
(0, vitest_1.expect)((0, TrinoWarehouseClient_1.getTrinoNumericKind)('bigint')).toEqual({ kind: 'integer' });
|
|
74
|
-
(0, vitest_1.expect)((0, TrinoWarehouseClient_1.getTrinoNumericKind)('tinyint')).toEqual({
|
|
75
|
-
kind: 'integer',
|
|
76
|
-
});
|
|
77
|
-
(0, vitest_1.expect)((0, TrinoWarehouseClient_1.getTrinoNumericKind)('double')).toEqual({ kind: 'float' });
|
|
78
|
-
(0, vitest_1.expect)((0, TrinoWarehouseClient_1.getTrinoNumericKind)('real')).toEqual({ kind: 'float' });
|
|
79
|
-
(0, vitest_1.expect)((0, TrinoWarehouseClient_1.getTrinoNumericKind)('decimal(10,2)')).toEqual({
|
|
80
|
-
kind: 'decimal',
|
|
81
|
-
scale: 2,
|
|
82
|
-
});
|
|
83
|
-
(0, vitest_1.expect)((0, TrinoWarehouseClient_1.getTrinoNumericKind)('decimal(38, 0)')).toEqual({
|
|
84
|
-
kind: 'decimal',
|
|
85
|
-
scale: 0,
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
(0, vitest_1.it)('reports nothing for a decimal without a scale or for other types', () => {
|
|
89
|
-
(0, vitest_1.expect)((0, TrinoWarehouseClient_1.getTrinoNumericKind)('decimal')).toBeNull();
|
|
90
|
-
(0, vitest_1.expect)((0, TrinoWarehouseClient_1.getTrinoNumericKind)('varchar')).toBeNull();
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
(0, vitest_1.describe)('Databricks', () => {
|
|
94
|
-
(0, vitest_1.it)('reads integers, floats and a decimal with its scale qualifier', () => {
|
|
95
|
-
(0, vitest_1.expect)((0, DatabricksWarehouseClient_1.getDatabricksNumericKind)({
|
|
96
|
-
type: TCLIService_types_1.TTypeId.BIGINT_TYPE,
|
|
97
|
-
})).toEqual({ kind: 'integer' });
|
|
98
|
-
(0, vitest_1.expect)((0, DatabricksWarehouseClient_1.getDatabricksNumericKind)({
|
|
99
|
-
type: TCLIService_types_1.TTypeId.DOUBLE_TYPE,
|
|
100
|
-
})).toEqual({ kind: 'float' });
|
|
101
|
-
(0, vitest_1.expect)((0, DatabricksWarehouseClient_1.getDatabricksNumericKind)({
|
|
102
|
-
type: TCLIService_types_1.TTypeId.DECIMAL_TYPE,
|
|
103
|
-
typeQualifiers: {
|
|
104
|
-
qualifiers: {
|
|
105
|
-
precision: { i32Value: 18 },
|
|
106
|
-
scale: { i32Value: 3 },
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
})).toEqual({ kind: 'decimal', scale: 3 });
|
|
110
|
-
});
|
|
111
|
-
(0, vitest_1.it)('reports nothing for a decimal without a scale qualifier or for other types', () => {
|
|
112
|
-
(0, vitest_1.expect)((0, DatabricksWarehouseClient_1.getDatabricksNumericKind)({
|
|
113
|
-
type: TCLIService_types_1.TTypeId.DECIMAL_TYPE,
|
|
114
|
-
})).toBeNull();
|
|
115
|
-
(0, vitest_1.expect)((0, DatabricksWarehouseClient_1.getDatabricksNumericKind)({
|
|
116
|
-
type: TCLIService_types_1.TTypeId.STRING_TYPE,
|
|
117
|
-
})).toBeNull();
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
(0, vitest_1.describe)('ClickHouse', () => {
|
|
121
|
-
(0, vitest_1.it)('reads integers and floats through Nullable and LowCardinality wrappers', () => {
|
|
122
|
-
(0, vitest_1.expect)((0, ClickhouseWarehouseClient_1.getClickhouseNumericKind)('Int64')).toEqual({
|
|
123
|
-
kind: 'integer',
|
|
124
|
-
});
|
|
125
|
-
(0, vitest_1.expect)((0, ClickhouseWarehouseClient_1.getClickhouseNumericKind)('Nullable(UInt64)')).toEqual({
|
|
126
|
-
kind: 'integer',
|
|
127
|
-
});
|
|
128
|
-
(0, vitest_1.expect)((0, ClickhouseWarehouseClient_1.getClickhouseNumericKind)('LowCardinality(Nullable(Float64))')).toEqual({ kind: 'float' });
|
|
129
|
-
});
|
|
130
|
-
(0, vitest_1.it)('reads the scale of Decimal(P, S), the spelling the server sends for every decimal', () => {
|
|
131
|
-
(0, vitest_1.expect)((0, ClickhouseWarehouseClient_1.getClickhouseNumericKind)('Decimal(18, 4)')).toEqual({
|
|
132
|
-
kind: 'decimal',
|
|
133
|
-
scale: 4,
|
|
134
|
-
});
|
|
135
|
-
(0, vitest_1.expect)((0, ClickhouseWarehouseClient_1.getClickhouseNumericKind)('Nullable(Decimal(10,2))')).toEqual({ kind: 'decimal', scale: 2 });
|
|
136
|
-
(0, vitest_1.expect)((0, ClickhouseWarehouseClient_1.getClickhouseNumericKind)('Decimal(38, 10)')).toEqual({
|
|
137
|
-
kind: 'decimal',
|
|
138
|
-
scale: 10,
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
(0, vitest_1.it)('reports nothing for a decimal wider than 38 digits or for other types', () => {
|
|
142
|
-
(0, vitest_1.expect)((0, ClickhouseWarehouseClient_1.getClickhouseNumericKind)('Decimal(76, 10)')).toBeNull();
|
|
143
|
-
(0, vitest_1.expect)((0, ClickhouseWarehouseClient_1.getClickhouseNumericKind)('String')).toBeNull();
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
(0, vitest_1.describe)('Athena', () => {
|
|
147
|
-
(0, vitest_1.it)('reads integers, floats and a decimal with the scale ColumnInfo reports', () => {
|
|
148
|
-
(0, vitest_1.expect)((0, AthenaWarehouseClient_1.getAthenaNumericKind)('bigint', 0)).toEqual({
|
|
149
|
-
kind: 'integer',
|
|
150
|
-
});
|
|
151
|
-
(0, vitest_1.expect)((0, AthenaWarehouseClient_1.getAthenaNumericKind)('double', 0)).toEqual({
|
|
152
|
-
kind: 'float',
|
|
153
|
-
});
|
|
154
|
-
(0, vitest_1.expect)((0, AthenaWarehouseClient_1.getAthenaNumericKind)('decimal', 2)).toEqual({
|
|
155
|
-
kind: 'decimal',
|
|
156
|
-
scale: 2,
|
|
157
|
-
});
|
|
158
|
-
(0, vitest_1.expect)((0, AthenaWarehouseClient_1.getAthenaNumericKind)('decimal(10,2)', 2)).toEqual({
|
|
159
|
-
kind: 'decimal',
|
|
160
|
-
scale: 2,
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
(0, vitest_1.it)('reports nothing for a decimal without a scale or for other types', () => {
|
|
164
|
-
(0, vitest_1.expect)((0, AthenaWarehouseClient_1.getAthenaNumericKind)('decimal', undefined)).toBeNull();
|
|
165
|
-
(0, vitest_1.expect)((0, AthenaWarehouseClient_1.getAthenaNumericKind)('varchar', undefined)).toBeNull();
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pgProtocolGuard.integration.test.d.ts","sourceRoot":"","sources":["../../src/warehouseClients/pgProtocolGuard.integration.test.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC"}
|