@lightdash/cli 0.1456.4 → 0.1457.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/models.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DbtDoc,
|
1
|
+
import { DbtDoc, DbtModelNode } from '@lightdash/common';
|
2
2
|
import { WarehouseClient, WarehouseTableSchema } from '@lightdash/warehouses';
|
3
3
|
import { YamlSchema } from './schema';
|
4
4
|
type CompiledModel = {
|
@@ -29,7 +29,6 @@ export declare const findAndUpdateModelYaml: ({ model, table, docs, includeMeta,
|
|
29
29
|
updatedYml: YamlSchema;
|
30
30
|
outputFilePath: string;
|
31
31
|
}>;
|
32
|
-
export declare const getModelsFromManifest: (manifest: DbtManifest) => DbtModelNode[];
|
33
32
|
export declare const getCompiledModels: (models: DbtModelNode[], args: {
|
34
33
|
select: string[] | undefined;
|
35
34
|
exclude: string[] | undefined;
|
package/dist/dbt/models.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getCompiledModels = exports.
|
3
|
+
exports.getCompiledModels = exports.findAndUpdateModelYaml = exports.isDocBlock = exports.getWarehouseTableForModel = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const common_1 = require("@lightdash/common");
|
6
6
|
const execa_1 = tslib_1.__importDefault(require("execa"));
|
@@ -191,19 +191,6 @@ const findAndUpdateModelYaml = async ({ model, table, docs, includeMeta, project
|
|
191
191
|
};
|
192
192
|
};
|
193
193
|
exports.findAndUpdateModelYaml = findAndUpdateModelYaml;
|
194
|
-
const getModelsFromManifest = (manifest) => {
|
195
|
-
const models = Object.values(manifest.nodes).filter((node) => node.resource_type === 'model' &&
|
196
|
-
node.config?.materialized !== 'ephemeral');
|
197
|
-
if (!(0, common_1.isSupportedDbtAdapter)(manifest.metadata)) {
|
198
|
-
throw new common_1.ParseError(`dbt adapter not supported. Lightdash does not support adapter ${manifest.metadata.adapter_type}`, {});
|
199
|
-
}
|
200
|
-
const adapterType = manifest.metadata.adapter_type;
|
201
|
-
return models
|
202
|
-
.filter((model) => model.config?.materialized &&
|
203
|
-
model.config.materialized !== 'ephemeral')
|
204
|
-
.map((model) => (0, common_1.normaliseModelDatabase)(model, adapterType));
|
205
|
-
};
|
206
|
-
exports.getModelsFromManifest = getModelsFromManifest;
|
207
194
|
const getCompiledModels = async (models, args) => {
|
208
195
|
let allModelIds = models.map((model) => model.unique_id);
|
209
196
|
if (args.select || args.exclude) {
|
package/dist/handlers/compile.js
CHANGED
@@ -8,7 +8,6 @@ const uuid_1 = require("uuid");
|
|
8
8
|
const analytics_1 = require("../analytics/analytics");
|
9
9
|
const context_1 = require("../dbt/context");
|
10
10
|
const manifest_1 = require("../dbt/manifest");
|
11
|
-
const models_1 = require("../dbt/models");
|
12
11
|
const validation_1 = require("../dbt/validation");
|
13
12
|
const globalState_1 = tslib_1.__importDefault(require("../globalState"));
|
14
13
|
const styles = tslib_1.__importStar(require("../styles"));
|
@@ -42,8 +41,8 @@ const compile = async (options) => {
|
|
42
41
|
const compiledModelIds = await (0, compile_1.maybeCompileModelsAndJoins)({ targetDir: context.targetDir }, options);
|
43
42
|
const manifest = await (0, manifest_1.loadManifest)({ targetDir: context.targetDir });
|
44
43
|
const manifestVersion = (0, common_1.getDbtManifestVersion)(manifest);
|
45
|
-
const manifestModels = (0,
|
46
|
-
const compiledModels = (0,
|
44
|
+
const manifestModels = (0, common_1.getModelsFromManifest)(manifest);
|
45
|
+
const compiledModels = (0, common_1.getCompiledModels)(manifestModels, compiledModelIds);
|
47
46
|
const adapterType = manifest.metadata.adapter_type;
|
48
47
|
const { valid: validModels, invalid: failedExplores } = await (0, validation_1.validateDbtModel)(adapterType, manifestVersion, compiledModels);
|
49
48
|
if (failedExplores.length > 0) {
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { DbtModelNode } from '@lightdash/common';
|
2
1
|
import { LoadManifestArgs } from '../../dbt/manifest';
|
3
2
|
export type DbtCompileOptions = {
|
4
3
|
profilesDir: string | undefined;
|
@@ -19,5 +18,4 @@ export type DbtCompileOptions = {
|
|
19
18
|
useDbtList: boolean | undefined;
|
20
19
|
};
|
21
20
|
export declare const dbtCompile: (options: DbtCompileOptions) => Promise<void>;
|
22
|
-
export declare function getCompiledModels(manifestModels: DbtModelNode[], compiledModelIds?: string[]): DbtModelNode[];
|
23
21
|
export declare function maybeCompileModelsAndJoins(loadManifestOpts: LoadManifestArgs, initialOptions: DbtCompileOptions): Promise<string[] | undefined>;
|
@@ -1,12 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.maybeCompileModelsAndJoins = exports.
|
3
|
+
exports.maybeCompileModelsAndJoins = exports.dbtCompile = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const common_1 = require("@lightdash/common");
|
6
6
|
const execa_1 = tslib_1.__importDefault(require("execa"));
|
7
7
|
const lodash_1 = require("lodash");
|
8
8
|
const manifest_1 = require("../../dbt/manifest");
|
9
|
-
const models_1 = require("../../dbt/models");
|
10
9
|
const globalState_1 = tslib_1.__importDefault(require("../../globalState"));
|
11
10
|
const getDbtVersion_1 = require("./getDbtVersion");
|
12
11
|
const dbtCompileArgs = [
|
@@ -53,15 +52,6 @@ const dbtCompile = async (options) => {
|
|
53
52
|
}
|
54
53
|
};
|
55
54
|
exports.dbtCompile = dbtCompile;
|
56
|
-
function getCompiledModels(manifestModels, compiledModelIds) {
|
57
|
-
return manifestModels.filter((model) => {
|
58
|
-
if (compiledModelIds) {
|
59
|
-
return compiledModelIds.includes(model.unique_id);
|
60
|
-
}
|
61
|
-
return model.compiled;
|
62
|
-
});
|
63
|
-
}
|
64
|
-
exports.getCompiledModels = getCompiledModels;
|
65
55
|
const getJoinedModelsRecursively = (modelNode, allModelNodes, visited = new Set()) => {
|
66
56
|
if (visited.has(modelNode.name)) {
|
67
57
|
globalState_1.default.debug(`Already visited ${modelNode.name}. Skipping.`);
|
@@ -148,8 +138,8 @@ async function maybeCompileModelsAndJoins(loadManifestOpts, initialOptions) {
|
|
148
138
|
}
|
149
139
|
// Load manifest and get all models
|
150
140
|
const manifest = await (0, manifest_1.loadManifest)(loadManifestOpts);
|
151
|
-
const allManifestModels = (0,
|
152
|
-
const currCompiledModels = getCompiledModels(allManifestModels, compiledModelIds);
|
141
|
+
const allManifestModels = (0, common_1.getModelsFromManifest)(manifest);
|
142
|
+
const currCompiledModels = (0, common_1.getCompiledModels)(allManifestModels, compiledModelIds);
|
153
143
|
// Get models and their joined models
|
154
144
|
const requiredModels = new Set(currCompiledModels.reduce((acc, model) => {
|
155
145
|
const joinedModelNames = getJoinedModelsRecursively(model, allManifestModels, new Set(acc));
|
@@ -59,7 +59,7 @@ const generateHandler = async (options) => {
|
|
59
59
|
startOfWeek: options.startOfWeek,
|
60
60
|
});
|
61
61
|
const manifest = await (0, manifest_1.loadManifest)({ targetDir: context.targetDir });
|
62
|
-
const models = (0,
|
62
|
+
const models = (0, common_1.getModelsFromManifest)(manifest);
|
63
63
|
const compiledModels = await (0, models_1.getCompiledModels)(models, {
|
64
64
|
projectDir: dbtVersion.isDbtCloudCLI ? undefined : absoluteProjectPath,
|
65
65
|
profilesDir: dbtVersion.isDbtCloudCLI
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lightdash/cli",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.1457.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"bin": {
|
6
6
|
"lightdash": "dist/index.js"
|
@@ -30,8 +30,8 @@
|
|
30
30
|
"parse-node-version": "^2.0.0",
|
31
31
|
"unique-names-generator": "^4.7.1",
|
32
32
|
"uuid": "^11.0.3",
|
33
|
-
"@lightdash/common": "0.
|
34
|
-
"@lightdash/warehouses": "0.
|
33
|
+
"@lightdash/common": "0.1457.0",
|
34
|
+
"@lightdash/warehouses": "0.1457.0"
|
35
35
|
},
|
36
36
|
"description": "Lightdash CLI tool",
|
37
37
|
"devDependencies": {
|