@lightdash/cli 0.2404.0 → 0.2406.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 +1 -1
- package/dist/dbt/profile.d.ts.map +1 -1
- package/dist/dbt/profile.js +3 -0
- package/dist/dbt/targets/athena.d.ts +19 -0
- package/dist/dbt/targets/athena.d.ts.map +1 -0
- package/dist/dbt/targets/athena.js +80 -0
- package/dist/handlers/dbt/getWarehouseClient.js +18 -17
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/dbt/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,0BAA0B,EAG7B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/dbt/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,0BAA0B,EAG7B,MAAM,mBAAmB,CAAC;AAc3B,OAAO,EAAE,eAAe,EAAY,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5D,eAAO,MAAM,aAAa,8CAIvB,eAAe,KAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA8B5D,CAAC;AAEF,eAAO,MAAM,iCAAiC,WAClC,MAAM,KACf,OAAO,CAAC,0BAA0B,CAuBpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,MAYxC,CAAC"}
|
package/dist/dbt/profile.js
CHANGED
|
@@ -7,6 +7,7 @@ const fs_1 = require("fs");
|
|
|
7
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
|
+
const athena_1 = require("./targets/athena");
|
|
10
11
|
const Bigquery_1 = require("./targets/Bigquery");
|
|
11
12
|
const clickhouse_1 = require("./targets/clickhouse");
|
|
12
13
|
const databricks_1 = require("./targets/databricks");
|
|
@@ -58,6 +59,8 @@ const warehouseCredentialsFromDbtTarget = async (target) => {
|
|
|
58
59
|
return (0, trino_1.convertTrinoSchema)(target);
|
|
59
60
|
case 'clickhouse':
|
|
60
61
|
return (0, clickhouse_1.convertClickhouseSchema)(target);
|
|
62
|
+
case 'athena':
|
|
63
|
+
return (0, athena_1.convertAthenaSchema)(target);
|
|
61
64
|
default:
|
|
62
65
|
throw new common_1.ParseError(`Sorry! Lightdash doesn't yet support ${target.type} dbt targets`);
|
|
63
66
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CreateAthenaCredentials } from '@lightdash/common';
|
|
2
|
+
import { JSONSchemaType } from 'ajv';
|
|
3
|
+
import { Target } from '../types';
|
|
4
|
+
export type AthenaTarget = {
|
|
5
|
+
type: 'athena';
|
|
6
|
+
region_name: string;
|
|
7
|
+
database: string;
|
|
8
|
+
schema: string;
|
|
9
|
+
s3_staging_dir: string;
|
|
10
|
+
s3_data_dir?: string;
|
|
11
|
+
aws_access_key_id: string;
|
|
12
|
+
aws_secret_access_key: string;
|
|
13
|
+
work_group?: string;
|
|
14
|
+
threads?: number;
|
|
15
|
+
num_retries?: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const athenaSchema: JSONSchemaType<AthenaTarget>;
|
|
18
|
+
export declare const convertAthenaSchema: (target: Target) => CreateAthenaCredentials;
|
|
19
|
+
//# sourceMappingURL=athena.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"athena.d.ts","sourceRoot":"","sources":["../../../src/dbt/targets/athena.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,uBAAuB,EAG1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAGrC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,YAAY,CAmDrD,CAAC;AAEF,eAAO,MAAM,mBAAmB,WACpB,MAAM,KACf,uBAuBF,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertAthenaSchema = exports.athenaSchema = 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.athenaSchema = {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
type: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
enum: ['athena'],
|
|
14
|
+
},
|
|
15
|
+
region_name: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
},
|
|
18
|
+
database: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
},
|
|
21
|
+
schema: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
},
|
|
24
|
+
s3_staging_dir: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
},
|
|
27
|
+
s3_data_dir: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
nullable: true,
|
|
30
|
+
},
|
|
31
|
+
aws_access_key_id: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
},
|
|
34
|
+
aws_secret_access_key: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
},
|
|
37
|
+
work_group: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
nullable: true,
|
|
40
|
+
},
|
|
41
|
+
threads: {
|
|
42
|
+
type: 'number',
|
|
43
|
+
nullable: true,
|
|
44
|
+
},
|
|
45
|
+
num_retries: {
|
|
46
|
+
type: 'number',
|
|
47
|
+
nullable: true,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
required: [
|
|
51
|
+
'type',
|
|
52
|
+
'region_name',
|
|
53
|
+
'database',
|
|
54
|
+
'schema',
|
|
55
|
+
's3_staging_dir',
|
|
56
|
+
'aws_access_key_id',
|
|
57
|
+
'aws_secret_access_key',
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
const convertAthenaSchema = (target) => {
|
|
61
|
+
const validate = ajv_1.ajv.compile(exports.athenaSchema);
|
|
62
|
+
if (validate(target)) {
|
|
63
|
+
return {
|
|
64
|
+
type: common_1.WarehouseTypes.ATHENA,
|
|
65
|
+
region: target.region_name,
|
|
66
|
+
database: target.database,
|
|
67
|
+
schema: target.schema,
|
|
68
|
+
s3StagingDir: target.s3_staging_dir,
|
|
69
|
+
s3DataDir: target.s3_data_dir,
|
|
70
|
+
accessKeyId: target.aws_access_key_id,
|
|
71
|
+
secretAccessKey: target.aws_secret_access_key,
|
|
72
|
+
workGroup: target.work_group,
|
|
73
|
+
threads: target.threads,
|
|
74
|
+
numRetries: target.num_retries,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const errs = (0, better_ajv_errors_1.default)(exports.athenaSchema, target, validate.errors || []);
|
|
78
|
+
throw new common_1.ParseError(`Couldn't read profiles.yml file for ${target.type}:\n${errs}`);
|
|
79
|
+
};
|
|
80
|
+
exports.convertAthenaSchema = convertAthenaSchema;
|
|
@@ -61,10 +61,9 @@ const getDbtCloudConnectionType = async () => {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
function getMockCredentials(dbtAdaptorType) {
|
|
64
|
-
let credentials;
|
|
65
64
|
switch (dbtAdaptorType) {
|
|
66
65
|
case common_1.SupportedDbtAdapter.BIGQUERY:
|
|
67
|
-
|
|
66
|
+
return {
|
|
68
67
|
type: common_1.WarehouseTypes.BIGQUERY,
|
|
69
68
|
project: '',
|
|
70
69
|
dataset: '',
|
|
@@ -75,9 +74,8 @@ function getMockCredentials(dbtAdaptorType) {
|
|
|
75
74
|
location: undefined,
|
|
76
75
|
maximumBytesBilled: undefined,
|
|
77
76
|
};
|
|
78
|
-
break;
|
|
79
77
|
case common_1.SupportedDbtAdapter.POSTGRES:
|
|
80
|
-
|
|
78
|
+
return {
|
|
81
79
|
type: common_1.WarehouseTypes.POSTGRES,
|
|
82
80
|
host: '',
|
|
83
81
|
user: '',
|
|
@@ -86,9 +84,8 @@ function getMockCredentials(dbtAdaptorType) {
|
|
|
86
84
|
dbname: '',
|
|
87
85
|
schema: '',
|
|
88
86
|
};
|
|
89
|
-
break;
|
|
90
87
|
case common_1.SupportedDbtAdapter.REDSHIFT:
|
|
91
|
-
|
|
88
|
+
return {
|
|
92
89
|
type: common_1.WarehouseTypes.REDSHIFT,
|
|
93
90
|
host: '',
|
|
94
91
|
user: '',
|
|
@@ -97,9 +94,8 @@ function getMockCredentials(dbtAdaptorType) {
|
|
|
97
94
|
dbname: '',
|
|
98
95
|
schema: '',
|
|
99
96
|
};
|
|
100
|
-
break;
|
|
101
97
|
case common_1.SupportedDbtAdapter.SNOWFLAKE:
|
|
102
|
-
|
|
98
|
+
return {
|
|
103
99
|
type: common_1.WarehouseTypes.SNOWFLAKE,
|
|
104
100
|
account: '',
|
|
105
101
|
user: '',
|
|
@@ -109,9 +105,8 @@ function getMockCredentials(dbtAdaptorType) {
|
|
|
109
105
|
schema: '',
|
|
110
106
|
role: '',
|
|
111
107
|
};
|
|
112
|
-
break;
|
|
113
108
|
case common_1.SupportedDbtAdapter.DATABRICKS:
|
|
114
|
-
|
|
109
|
+
return {
|
|
115
110
|
type: common_1.WarehouseTypes.DATABRICKS,
|
|
116
111
|
catalog: '',
|
|
117
112
|
database: '',
|
|
@@ -119,9 +114,8 @@ function getMockCredentials(dbtAdaptorType) {
|
|
|
119
114
|
httpPath: '',
|
|
120
115
|
personalAccessToken: '',
|
|
121
116
|
};
|
|
122
|
-
break;
|
|
123
117
|
case common_1.SupportedDbtAdapter.TRINO:
|
|
124
|
-
|
|
118
|
+
return {
|
|
125
119
|
type: common_1.WarehouseTypes.TRINO,
|
|
126
120
|
host: '',
|
|
127
121
|
user: '',
|
|
@@ -131,9 +125,8 @@ function getMockCredentials(dbtAdaptorType) {
|
|
|
131
125
|
schema: '',
|
|
132
126
|
http_scheme: '',
|
|
133
127
|
};
|
|
134
|
-
break;
|
|
135
128
|
case common_1.SupportedDbtAdapter.CLICKHOUSE:
|
|
136
|
-
|
|
129
|
+
return {
|
|
137
130
|
type: common_1.WarehouseTypes.CLICKHOUSE,
|
|
138
131
|
host: '',
|
|
139
132
|
user: '',
|
|
@@ -143,11 +136,19 @@ function getMockCredentials(dbtAdaptorType) {
|
|
|
143
136
|
secure: true,
|
|
144
137
|
timeoutSeconds: 300,
|
|
145
138
|
};
|
|
146
|
-
|
|
139
|
+
case common_1.SupportedDbtAdapter.ATHENA:
|
|
140
|
+
return {
|
|
141
|
+
type: common_1.WarehouseTypes.ATHENA,
|
|
142
|
+
region: '',
|
|
143
|
+
database: '',
|
|
144
|
+
schema: '',
|
|
145
|
+
s3StagingDir: '',
|
|
146
|
+
accessKeyId: '',
|
|
147
|
+
secretAccessKey: '',
|
|
148
|
+
};
|
|
147
149
|
default:
|
|
148
|
-
(0, common_1.assertUnreachable)(dbtAdaptorType, `Unsupported dbt adaptor type ${dbtAdaptorType}`);
|
|
150
|
+
return (0, common_1.assertUnreachable)(dbtAdaptorType, `Unsupported dbt adaptor type ${dbtAdaptorType}`);
|
|
149
151
|
}
|
|
150
|
-
return credentials;
|
|
151
152
|
}
|
|
152
153
|
/*
|
|
153
154
|
Generates a temporary Snowflake PAT to enable access on Lightdash which expires in 1 day.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2406.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"unique-names-generator": "^4.7.1",
|
|
39
39
|
"uuid": "^11.0.3",
|
|
40
40
|
"yaml": "^2.7.0",
|
|
41
|
-
"@lightdash/
|
|
42
|
-
"@lightdash/
|
|
41
|
+
"@lightdash/warehouses": "0.2406.0",
|
|
42
|
+
"@lightdash/common": "0.2406.0"
|
|
43
43
|
},
|
|
44
44
|
"description": "Lightdash CLI tool",
|
|
45
45
|
"devDependencies": {
|