@lightdash/cli 0.2115.0 → 0.2116.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/context.d.ts.map +1 -1
- package/dist/dbt/context.js +23 -16
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/dbt/context.ts"],"names":[],"mappings":"AAOA,KAAK,iBAAiB,GAAG;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AACF,MAAM,MAAM,UAAU,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/dbt/context.ts"],"names":[],"mappings":"AAOA,KAAK,iBAAiB,GAAG;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AACF,MAAM,MAAM,UAAU,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAkBF,eAAO,MAAM,aAAa,uCAGvB,iBAAiB,KAAG,OAAO,CAAC,UAAU,CA+CxC,CAAC"}
|
package/dist/dbt/context.js
CHANGED
|
@@ -8,6 +8,16 @@ const yaml = tslib_1.__importStar(require("js-yaml"));
|
|
|
8
8
|
const path = tslib_1.__importStar(require("path"));
|
|
9
9
|
const globalState_1 = tslib_1.__importDefault(require("../globalState"));
|
|
10
10
|
const templating_1 = require("./templating");
|
|
11
|
+
function tryRenderVariable(variableName, raw) {
|
|
12
|
+
try {
|
|
13
|
+
return (0, templating_1.renderTemplatedYml)(raw);
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
globalState_1.default.debug(`> Warning: Failed to render Jinja in dbt_project.yml ${variableName}: ${(0, common_1.getErrorMessage)(e)}`);
|
|
17
|
+
globalState_1.default.debug('> Falling back to parsing raw YAML without Jinja rendering');
|
|
18
|
+
return raw;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
11
21
|
const getDbtContext = async ({ projectDir, initialProjectDir, }) => {
|
|
12
22
|
globalState_1.default.debug(`> Loading dbt_project.yml file from: ${projectDir}`);
|
|
13
23
|
const projectFilename = path.join(projectDir, 'dbt_project.yml');
|
|
@@ -26,26 +36,23 @@ const getDbtContext = async ({ projectDir, initialProjectDir, }) => {
|
|
|
26
36
|
const msg = (0, common_1.getErrorMessage)(e);
|
|
27
37
|
throw new common_1.ParseError(`Is ${initialProjectDir} a valid dbt project directory? Couldn't find a valid dbt_project.yml on ${initialProjectDir} or any of its parents:\n ${msg}`);
|
|
28
38
|
}
|
|
29
|
-
|
|
30
|
-
//
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const config = yaml.load(renderedFile);
|
|
41
|
-
const targetSubDir = config['target-path'] || './target';
|
|
39
|
+
const config = yaml.load(file);
|
|
40
|
+
// Try to render Jinja templating (e.g., env_var) for each individual config key needed
|
|
41
|
+
let targetSubDir = config['target-path'] || './target';
|
|
42
|
+
let modelsSubDir = config['models-path'] || './models';
|
|
43
|
+
let projectName = config.name;
|
|
44
|
+
let profileName = config.profile;
|
|
45
|
+
// ! Important: We only render the variables that are needed for the context, other variables are not rendered to avoid unexpected behavior.
|
|
46
|
+
targetSubDir = tryRenderVariable('target-path', targetSubDir);
|
|
47
|
+
modelsSubDir = tryRenderVariable('models-path', modelsSubDir);
|
|
48
|
+
projectName = tryRenderVariable('name', projectName);
|
|
49
|
+
profileName = tryRenderVariable('profile', profileName);
|
|
42
50
|
globalState_1.default.debug(`> dbt target directory: ${targetSubDir}`);
|
|
43
51
|
const targetDir = path.join(projectDir, targetSubDir);
|
|
44
|
-
const modelsSubDir = config['models-path'] || './models';
|
|
45
52
|
const modelsDir = path.join(projectDir, modelsSubDir);
|
|
46
53
|
return {
|
|
47
|
-
projectName
|
|
48
|
-
profileName
|
|
54
|
+
projectName,
|
|
55
|
+
profileName,
|
|
49
56
|
targetDir,
|
|
50
57
|
modelsDir,
|
|
51
58
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2116.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lightdash": "dist/index.js"
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"parse-node-version": "^2.0.0",
|
|
34
34
|
"unique-names-generator": "^4.7.1",
|
|
35
35
|
"uuid": "^11.0.3",
|
|
36
|
-
"@lightdash/
|
|
37
|
-
"@lightdash/
|
|
36
|
+
"@lightdash/warehouses": "0.2116.0",
|
|
37
|
+
"@lightdash/common": "0.2116.0"
|
|
38
38
|
},
|
|
39
39
|
"description": "Lightdash CLI tool",
|
|
40
40
|
"devDependencies": {
|