@lightdash/cli 0.2019.0 → 0.2021.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/dbt/profile.js
CHANGED
|
@@ -8,6 +8,7 @@ const yaml = tslib_1.__importStar(require("js-yaml"));
|
|
|
8
8
|
const os_1 = require("os");
|
|
9
9
|
const path = tslib_1.__importStar(require("path"));
|
|
10
10
|
const Bigquery_1 = require("./targets/Bigquery");
|
|
11
|
+
const clickhouse_1 = require("./targets/clickhouse");
|
|
11
12
|
const databricks_1 = require("./targets/databricks");
|
|
12
13
|
const postgres_1 = require("./targets/postgres");
|
|
13
14
|
const redshift_1 = require("./targets/redshift");
|
|
@@ -55,6 +56,8 @@ const warehouseCredentialsFromDbtTarget = async (target) => {
|
|
|
55
56
|
return (0, databricks_1.convertDatabricksSchema)(target);
|
|
56
57
|
case 'trino':
|
|
57
58
|
return (0, trino_1.convertTrinoSchema)(target);
|
|
59
|
+
case 'clickhouse':
|
|
60
|
+
return (0, clickhouse_1.convertClickhouseSchema)(target);
|
|
58
61
|
default:
|
|
59
62
|
throw new common_1.ParseError(`Sorry! Lightdash doesn't yet support ${target.type} dbt targets`);
|
|
60
63
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CreateClickhouseCredentials } from '@lightdash/common';
|
|
2
|
+
import { JSONSchemaType } from 'ajv';
|
|
3
|
+
import { Target } from '../types';
|
|
4
|
+
export type ClickhouseTarget = {
|
|
5
|
+
type: 'clickhouse';
|
|
6
|
+
host: string;
|
|
7
|
+
user: string;
|
|
8
|
+
password: string;
|
|
9
|
+
port: number;
|
|
10
|
+
schema: string;
|
|
11
|
+
driver?: string;
|
|
12
|
+
cluster?: string;
|
|
13
|
+
verify?: boolean;
|
|
14
|
+
secure?: boolean;
|
|
15
|
+
retries?: number;
|
|
16
|
+
compression?: boolean;
|
|
17
|
+
connect_timeout?: number;
|
|
18
|
+
send_receive_timeout?: number;
|
|
19
|
+
cluster_mode?: boolean;
|
|
20
|
+
custom_settings?: Record<string, unknown>;
|
|
21
|
+
};
|
|
22
|
+
export declare const clickhouseSchema: JSONSchemaType<ClickhouseTarget>;
|
|
23
|
+
export declare const convertClickhouseSchema: (target: Target) => CreateClickhouseCredentials;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertClickhouseSchema = exports.clickhouseSchema = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@lightdash/common");
|
|
6
|
+
const better_ajv_errors_1 = tslib_1.__importDefault(require("better-ajv-errors"));
|
|
7
|
+
const ajv_1 = require("../../ajv");
|
|
8
|
+
exports.clickhouseSchema = {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
type: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
enum: ['clickhouse'],
|
|
14
|
+
},
|
|
15
|
+
host: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
},
|
|
18
|
+
user: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
},
|
|
21
|
+
password: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
},
|
|
24
|
+
port: {
|
|
25
|
+
type: 'number',
|
|
26
|
+
},
|
|
27
|
+
schema: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
},
|
|
30
|
+
driver: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
nullable: true,
|
|
33
|
+
},
|
|
34
|
+
cluster: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
nullable: true,
|
|
37
|
+
},
|
|
38
|
+
verify: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
nullable: true,
|
|
41
|
+
},
|
|
42
|
+
secure: {
|
|
43
|
+
type: 'boolean',
|
|
44
|
+
nullable: true,
|
|
45
|
+
},
|
|
46
|
+
retries: {
|
|
47
|
+
type: 'number',
|
|
48
|
+
nullable: true,
|
|
49
|
+
},
|
|
50
|
+
compression: {
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
nullable: true,
|
|
53
|
+
},
|
|
54
|
+
connect_timeout: {
|
|
55
|
+
type: 'number',
|
|
56
|
+
nullable: true,
|
|
57
|
+
},
|
|
58
|
+
send_receive_timeout: {
|
|
59
|
+
type: 'number',
|
|
60
|
+
nullable: true,
|
|
61
|
+
},
|
|
62
|
+
cluster_mode: {
|
|
63
|
+
type: 'boolean',
|
|
64
|
+
nullable: true,
|
|
65
|
+
},
|
|
66
|
+
custom_settings: {
|
|
67
|
+
type: 'object',
|
|
68
|
+
nullable: true,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
required: ['type', 'host', 'user', 'password', 'port', 'schema'],
|
|
72
|
+
};
|
|
73
|
+
const convertClickhouseSchema = (target) => {
|
|
74
|
+
const validate = ajv_1.ajv.compile(exports.clickhouseSchema);
|
|
75
|
+
if (validate(target)) {
|
|
76
|
+
return {
|
|
77
|
+
type: common_1.WarehouseTypes.CLICKHOUSE,
|
|
78
|
+
host: target.host,
|
|
79
|
+
user: target.user,
|
|
80
|
+
password: target.password,
|
|
81
|
+
port: target.port,
|
|
82
|
+
schema: target.schema,
|
|
83
|
+
secure: target.secure ?? true,
|
|
84
|
+
timeoutSeconds: target.send_receive_timeout,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const errs = (0, better_ajv_errors_1.default)(exports.clickhouseSchema, target, validate.errors || []);
|
|
88
|
+
throw new common_1.ParseError(`Couldn't read profiles.yml file for ${target.type}:\n${errs}`);
|
|
89
|
+
};
|
|
90
|
+
exports.convertClickhouseSchema = convertClickhouseSchema;
|
|
@@ -110,6 +110,18 @@ function getMockCredentials(dbtAdaptorType) {
|
|
|
110
110
|
http_scheme: '',
|
|
111
111
|
};
|
|
112
112
|
break;
|
|
113
|
+
case common_1.SupportedDbtAdapter.CLICKHOUSE:
|
|
114
|
+
credentials = {
|
|
115
|
+
type: common_1.WarehouseTypes.CLICKHOUSE,
|
|
116
|
+
host: '',
|
|
117
|
+
user: '',
|
|
118
|
+
password: '',
|
|
119
|
+
port: 8443,
|
|
120
|
+
schema: '',
|
|
121
|
+
secure: true,
|
|
122
|
+
timeoutSeconds: 300,
|
|
123
|
+
};
|
|
124
|
+
break;
|
|
113
125
|
default:
|
|
114
126
|
(0, common_1.assertUnreachable)(dbtAdaptorType, `Unsupported dbt adaptor type ${dbtAdaptorType}`);
|
|
115
127
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2021.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lightdash": "dist/index.js"
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"parse-node-version": "^2.0.0",
|
|
33
33
|
"unique-names-generator": "^4.7.1",
|
|
34
34
|
"uuid": "^11.0.3",
|
|
35
|
-
"@lightdash/
|
|
36
|
-
"@lightdash/
|
|
35
|
+
"@lightdash/warehouses": "0.2021.0",
|
|
36
|
+
"@lightdash/common": "0.2021.0"
|
|
37
37
|
},
|
|
38
38
|
"description": "Lightdash CLI tool",
|
|
39
39
|
"devDependencies": {
|