@lightdash/cli 0.3472.3 → 0.3474.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/handlers/compile.d.ts +1 -0
- package/dist/handlers/compile.d.ts.map +1 -1
- package/dist/handlers/compile.js +15 -9
- package/dist/handlers/compile.test.js +82 -139
- package/dist/handlers/compileWarehouseColumnValidation.test.js +7 -11
- package/dist/handlers/deploy.d.ts +1 -0
- package/dist/handlers/deploy.d.ts.map +1 -1
- package/dist/handlers/download.d.ts +1 -1
- package/dist/handlers/download.d.ts.map +1 -1
- package/dist/handlers/download.js +4 -11
- package/dist/handlers/download.test.js +8 -8
- package/dist/handlers/preview.d.ts +1 -0
- package/dist/handlers/preview.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/package.json +3 -3
|
@@ -11,6 +11,7 @@ export type CompileHandlerOptions = DbtCompileOptions & {
|
|
|
11
11
|
warehouseCredentials?: boolean;
|
|
12
12
|
disableTimestampConversion?: boolean;
|
|
13
13
|
validateWarehouseColumns?: boolean;
|
|
14
|
+
partialCompilation?: boolean;
|
|
14
15
|
};
|
|
15
16
|
export declare const hasBlockingCompileError: (explore: Explore | ExploreError) => boolean;
|
|
16
17
|
export declare const stripWarehouseColumnErrors: (explore: Explore | ExploreError) => Explore | ExploreError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/handlers/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,OAAO,EACP,YAAY,EAgBf,MAAM,mBAAmB,CAAC;AAoB3B,OAAO,EAAE,iBAAiB,EAA8B,MAAM,eAAe,CAAC;AAI9E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,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js
CHANGED
|
@@ -35,16 +35,15 @@ const stripWarehouseColumnErrors = (explore) => {
|
|
|
35
35
|
: exploreWithoutWarnings;
|
|
36
36
|
};
|
|
37
37
|
exports.stripWarehouseColumnErrors = stripWarehouseColumnErrors;
|
|
38
|
-
const getDisplayableDiagnostics = (explore) => {
|
|
38
|
+
const getDisplayableDiagnostics = (explore, allowPartialCompilation) => {
|
|
39
39
|
const diagnostics = explore.warnings ?? [];
|
|
40
40
|
const errors = diagnostics.filter((diagnostic) => diagnostic.type === common_1.InlineErrorType.WAREHOUSE_COLUMN_ERROR);
|
|
41
|
-
const warnings =
|
|
42
|
-
? diagnostics.filter((diagnostic) => diagnostic.type !==
|
|
43
|
-
common_1.InlineErrorType.WAREHOUSE_COLUMN_ERROR)
|
|
41
|
+
const warnings = allowPartialCompilation
|
|
42
|
+
? diagnostics.filter((diagnostic) => diagnostic.type !== common_1.InlineErrorType.WAREHOUSE_COLUMN_ERROR)
|
|
44
43
|
: [];
|
|
45
44
|
return { errors, warnings };
|
|
46
45
|
};
|
|
47
|
-
const getExploresFromLightdashYmlProject = async (projectDir, lightdashProjectConfig, startOfWeek, disableTimestampConversion) => {
|
|
46
|
+
const getExploresFromLightdashYmlProject = async ({ projectDir, lightdashProjectConfig, startOfWeek, disableTimestampConversion, allowPartialCompilation, }) => {
|
|
48
47
|
// Try to load Lightdash YAML models
|
|
49
48
|
const lightdashModels = await (0, loader_1.loadLightdashModels)(projectDir);
|
|
50
49
|
if (lightdashModels.length === 0) {
|
|
@@ -68,7 +67,7 @@ const getExploresFromLightdashYmlProject = async (projectDir, lightdashProjectCo
|
|
|
68
67
|
const warehouseSqlBuilder = (0, warehouses_1.warehouseSqlBuilderFromType)(adapterType, startOfWeek);
|
|
69
68
|
const validExplores = await (0, common_1.convertExplores)(validModels, false, warehouseSqlBuilder.getAdapterType(), warehouseSqlBuilder, lightdashProjectConfig, {
|
|
70
69
|
disableTimestampConversion,
|
|
71
|
-
allowPartialCompilation
|
|
70
|
+
allowPartialCompilation,
|
|
72
71
|
postProcessors: [common_1.preAggregatePostProcessor],
|
|
73
72
|
});
|
|
74
73
|
return validExplores;
|
|
@@ -172,6 +171,7 @@ const compile = async (options) => {
|
|
|
172
171
|
const dbtVersionResult = await (0, getDbtVersion_1.tryGetDbtVersion)();
|
|
173
172
|
const executionId = (0, uuid_1.v4)();
|
|
174
173
|
const startTime = Date.now();
|
|
174
|
+
const allowPartialCompilation = options.partialCompilation !== false;
|
|
175
175
|
await analytics_1.LightdashAnalytics.track({
|
|
176
176
|
event: 'compile.started',
|
|
177
177
|
properties: {
|
|
@@ -191,7 +191,13 @@ const compile = async (options) => {
|
|
|
191
191
|
// Try lightdash project compile
|
|
192
192
|
let explores = null;
|
|
193
193
|
let dbtMetrics = null;
|
|
194
|
-
explores = await getExploresFromLightdashYmlProject(
|
|
194
|
+
explores = await getExploresFromLightdashYmlProject({
|
|
195
|
+
projectDir: absoluteProjectPath,
|
|
196
|
+
lightdashProjectConfig,
|
|
197
|
+
startOfWeek: options.startOfWeek,
|
|
198
|
+
disableTimestampConversion: options.disableTimestampConversion,
|
|
199
|
+
allowPartialCompilation,
|
|
200
|
+
});
|
|
195
201
|
if (explores !== null && options.validateWarehouseColumns === true) {
|
|
196
202
|
console.error(styles.warning('> Skipping warehouse column validation because it is not supported for Lightdash YAML projects'));
|
|
197
203
|
}
|
|
@@ -295,7 +301,7 @@ const compile = async (options) => {
|
|
|
295
301
|
const warehouseSqlBuilder = (0, warehouses_1.warehouseSqlBuilderFromType)(adapterType, options.startOfWeek);
|
|
296
302
|
const validExplores = await (0, common_1.convertExplores)(validModelsWithTypes, false, manifest.metadata.adapter_type, warehouseSqlBuilder, lightdashProjectConfig, {
|
|
297
303
|
disableTimestampConversion: options.disableTimestampConversion,
|
|
298
|
-
allowPartialCompilation
|
|
304
|
+
allowPartialCompilation,
|
|
299
305
|
postProcessors: [common_1.preAggregatePostProcessor],
|
|
300
306
|
});
|
|
301
307
|
const validatedExplores = options.validateWarehouseColumns === true &&
|
|
@@ -324,7 +330,7 @@ const compile = async (options) => {
|
|
|
324
330
|
errors += 1;
|
|
325
331
|
}
|
|
326
332
|
else {
|
|
327
|
-
const { errors: warehouseErrors, warnings } = getDisplayableDiagnostics(e);
|
|
333
|
+
const { errors: warehouseErrors, warnings } = getDisplayableDiagnostics(e, allowPartialCompilation);
|
|
328
334
|
if (warehouseErrors.length > 0) {
|
|
329
335
|
status = styles.error('ERROR');
|
|
330
336
|
messages = `: ${styles.error(warehouseErrors.map((error) => error.message).join(', '))}`;
|
|
@@ -1,16 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
const common_1 = require("@lightdash/common");
|
|
4
5
|
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
|
|
5
6
|
const os = tslib_1.__importStar(require("os"));
|
|
6
7
|
const path = tslib_1.__importStar(require("path"));
|
|
7
|
-
const
|
|
8
|
+
const lightdashLoader = tslib_1.__importStar(require("../lightdash/loader"));
|
|
8
9
|
const compile_1 = require("./compile");
|
|
9
10
|
vi.mock('execa');
|
|
10
11
|
vi.mock('../analytics/analytics');
|
|
11
12
|
vi.mock('../config', () => ({
|
|
12
13
|
getConfig: vi.fn().mockResolvedValue({ user: null, context: null }),
|
|
13
14
|
}));
|
|
15
|
+
const modelWithBrokenMetric = {
|
|
16
|
+
type: 'model',
|
|
17
|
+
name: 'test_model',
|
|
18
|
+
description: 'Test model',
|
|
19
|
+
sql_from: 'SELECT * FROM test_table',
|
|
20
|
+
dimensions: [
|
|
21
|
+
{
|
|
22
|
+
name: 'id',
|
|
23
|
+
description: 'ID column',
|
|
24
|
+
type: common_1.DimensionType.NUMBER,
|
|
25
|
+
sql: 'id',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
metrics: {
|
|
29
|
+
broken_metric: {
|
|
30
|
+
type: common_1.MetricType.SUM,
|
|
31
|
+
sql: `\${missing_dimension}`,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
const getCompileOptions = (projectDir) => ({
|
|
36
|
+
projectDir,
|
|
37
|
+
profilesDir: '',
|
|
38
|
+
target: undefined,
|
|
39
|
+
profile: undefined,
|
|
40
|
+
vars: undefined,
|
|
41
|
+
verbose: false,
|
|
42
|
+
startOfWeek: 0,
|
|
43
|
+
skipWarehouseCatalog: true,
|
|
44
|
+
skipDbtCompile: true,
|
|
45
|
+
useDbtList: false,
|
|
46
|
+
select: undefined,
|
|
47
|
+
models: undefined,
|
|
48
|
+
threads: undefined,
|
|
49
|
+
noVersionCheck: false,
|
|
50
|
+
exclude: undefined,
|
|
51
|
+
selector: undefined,
|
|
52
|
+
state: undefined,
|
|
53
|
+
fullRefresh: false,
|
|
54
|
+
defer: false,
|
|
55
|
+
targetPath: undefined,
|
|
56
|
+
favorState: false,
|
|
57
|
+
combineManifest: undefined,
|
|
58
|
+
warehouseCredentials: false,
|
|
59
|
+
disableTimestampConversion: false,
|
|
60
|
+
});
|
|
14
61
|
describe('compile', () => {
|
|
15
62
|
let tempDir;
|
|
16
63
|
beforeEach(async () => {
|
|
@@ -38,38 +85,14 @@ dimensions:
|
|
|
38
85
|
`);
|
|
39
86
|
});
|
|
40
87
|
afterEach(async () => {
|
|
88
|
+
vi.restoreAllMocks();
|
|
41
89
|
await promises_1.default.rm(tempDir, { recursive: true, force: true });
|
|
42
90
|
});
|
|
43
91
|
test('should compile Lightdash YAML project without dbt installed', async () => {
|
|
44
92
|
// Mock analytics to prevent actual tracking
|
|
45
93
|
const { LightdashAnalytics } = await Promise.resolve().then(() => tslib_1.__importStar(require('../analytics/analytics')));
|
|
46
94
|
LightdashAnalytics.track.mockResolvedValue(undefined);
|
|
47
|
-
const result = await (0, compile_1.compile)(
|
|
48
|
-
projectDir: tempDir,
|
|
49
|
-
profilesDir: '',
|
|
50
|
-
target: undefined,
|
|
51
|
-
profile: undefined,
|
|
52
|
-
vars: undefined,
|
|
53
|
-
verbose: false,
|
|
54
|
-
startOfWeek: 0,
|
|
55
|
-
skipWarehouseCatalog: true,
|
|
56
|
-
skipDbtCompile: true,
|
|
57
|
-
useDbtList: false,
|
|
58
|
-
select: undefined,
|
|
59
|
-
models: undefined,
|
|
60
|
-
threads: undefined,
|
|
61
|
-
noVersionCheck: false,
|
|
62
|
-
exclude: undefined,
|
|
63
|
-
selector: undefined,
|
|
64
|
-
state: undefined,
|
|
65
|
-
fullRefresh: false,
|
|
66
|
-
defer: false,
|
|
67
|
-
targetPath: undefined,
|
|
68
|
-
favorState: false,
|
|
69
|
-
combineManifest: undefined,
|
|
70
|
-
warehouseCredentials: false,
|
|
71
|
-
disableTimestampConversion: false,
|
|
72
|
-
});
|
|
95
|
+
const result = await (0, compile_1.compile)(getCompileOptions(tempDir));
|
|
73
96
|
// Should succeed even though dbt is not installed
|
|
74
97
|
expect(result).toBeDefined();
|
|
75
98
|
expect(result.length).toBeGreaterThan(0);
|
|
@@ -86,119 +109,39 @@ dimensions:
|
|
|
86
109
|
}));
|
|
87
110
|
// Verify compile.started was called with undefined dbtVersion
|
|
88
111
|
const startedCall = trackCalls.find((call) => call[0].event === 'compile.started');
|
|
89
|
-
|
|
112
|
+
if (startedCall === undefined) {
|
|
113
|
+
throw new Error('Expected compile.started analytics event');
|
|
114
|
+
}
|
|
90
115
|
expect(startedCall[0].properties.dbtVersion).toBeUndefined();
|
|
91
116
|
});
|
|
92
|
-
test('should
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
type: 'FIELD_ERROR',
|
|
122
|
-
message: 'Field compilation warning',
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: 'failed_explore',
|
|
128
|
-
label: 'Failed Explore',
|
|
129
|
-
tags: [],
|
|
130
|
-
errors: [
|
|
131
|
-
{
|
|
132
|
-
type: 'NO_DIMENSIONS_FOUND',
|
|
133
|
-
message: 'No dimensions found in model',
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
},
|
|
137
|
-
];
|
|
138
|
-
// Simulate the explore display logic from compile.ts
|
|
139
|
-
let errors = 0;
|
|
140
|
-
let partialSuccess = 0;
|
|
141
|
-
let success = 0;
|
|
142
|
-
mockExplores.forEach((e) => {
|
|
143
|
-
let status;
|
|
144
|
-
let messages = '';
|
|
145
|
-
if ('errors' in e && e.errors) {
|
|
146
|
-
status = styles.error('ERROR');
|
|
147
|
-
messages = `: ${styles.error(e.errors.map((err) => err.message).join(', '))}`;
|
|
148
|
-
errors += 1;
|
|
149
|
-
}
|
|
150
|
-
else if (process.env.PARTIAL_COMPILATION_ENABLED !== 'false' &&
|
|
151
|
-
'warnings' in e &&
|
|
152
|
-
e.warnings &&
|
|
153
|
-
e.warnings.length > 0) {
|
|
154
|
-
status = styles.warning('PARTIAL_SUCCESS');
|
|
155
|
-
messages = `: ${styles.warning(e.warnings
|
|
156
|
-
.map((warning) => warning.message)
|
|
157
|
-
.join(', '))}`;
|
|
158
|
-
partialSuccess += 1;
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
status = styles.success('SUCCESS');
|
|
162
|
-
success += 1;
|
|
163
|
-
}
|
|
164
|
-
console.error(`- ${status}> ${e.name} ${messages}`);
|
|
165
|
-
});
|
|
166
|
-
console.error('');
|
|
167
|
-
// Display summary
|
|
168
|
-
if (process.env.PARTIAL_COMPILATION_ENABLED !== 'false' &&
|
|
169
|
-
partialSuccess > 0) {
|
|
170
|
-
console.error(`Compiled ${mockExplores.length} explores, SUCCESS=${success} PARTIAL_SUCCESS=${partialSuccess} ERRORS=${errors}`);
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
console.error(`Compiled ${mockExplores.length} explores, SUCCESS=${success} ERRORS=${errors}`);
|
|
174
|
-
}
|
|
175
|
-
// Verify the output
|
|
176
|
-
const calls = consoleSpy.mock.calls.map((call) => call[0]);
|
|
177
|
-
// Check that PARTIAL_SUCCESS status is displayed
|
|
178
|
-
const partialSuccessCall = calls.find((call) => typeof call === 'string' &&
|
|
179
|
-
call.includes('PARTIAL_SUCCESS> explore_with_warnings'));
|
|
180
|
-
expect(partialSuccessCall).toBeDefined();
|
|
181
|
-
expect(partialSuccessCall).toContain('Join to table "missing_table" was skipped');
|
|
182
|
-
expect(partialSuccessCall).toContain('Field compilation warning');
|
|
183
|
-
// Check that SUCCESS status is displayed
|
|
184
|
-
const successCall = calls.find((call) => typeof call === 'string' &&
|
|
185
|
-
call.includes('SUCCESS> successful_explore'));
|
|
186
|
-
expect(successCall).toBeDefined();
|
|
187
|
-
// Check that ERROR status is displayed
|
|
188
|
-
const errorCall = calls.find((call) => typeof call === 'string' &&
|
|
189
|
-
call.includes('ERROR> failed_explore'));
|
|
190
|
-
expect(errorCall).toBeDefined();
|
|
191
|
-
// Check the summary includes PARTIAL_SUCCESS count
|
|
192
|
-
const summaryCall = calls.find((call) => typeof call === 'string' &&
|
|
193
|
-
call.includes('Compiled') &&
|
|
194
|
-
call.includes('PARTIAL_SUCCESS='));
|
|
195
|
-
expect(summaryCall).toBeDefined();
|
|
196
|
-
expect(summaryCall).toContain('SUCCESS=1 PARTIAL_SUCCESS=1 ERRORS=1');
|
|
197
|
-
}
|
|
198
|
-
finally {
|
|
199
|
-
// Clean up
|
|
200
|
-
consoleSpy.mockRestore();
|
|
201
|
-
process.env.PARTIAL_COMPILATION_ENABLED = originalEnv;
|
|
202
|
-
}
|
|
117
|
+
test('should allow partial compilation by default and allow it to be disabled explicitly', async () => {
|
|
118
|
+
vi.spyOn(lightdashLoader, 'loadLightdashModels').mockResolvedValue([
|
|
119
|
+
modelWithBrokenMetric,
|
|
120
|
+
]);
|
|
121
|
+
const errorOutput = [];
|
|
122
|
+
vi.spyOn(console, 'error').mockImplementation((...args) => {
|
|
123
|
+
errorOutput.push(args.map(String).join(' '));
|
|
124
|
+
});
|
|
125
|
+
const partialResult = await (0, compile_1.compile)(getCompileOptions(tempDir));
|
|
126
|
+
expect(partialResult.filter(common_1.isExploreError)).toHaveLength(0);
|
|
127
|
+
expect(partialResult.flatMap((explore) => (0, common_1.isExploreError)(explore) ? [] : (explore.warnings ?? []))).toEqual(expect.arrayContaining([
|
|
128
|
+
expect.objectContaining({
|
|
129
|
+
message: expect.stringContaining('broken_metric'),
|
|
130
|
+
}),
|
|
131
|
+
]));
|
|
132
|
+
expect(errorOutput).toEqual(expect.arrayContaining([
|
|
133
|
+
expect.stringContaining('- PARTIAL_SUCCESS> test_model'),
|
|
134
|
+
expect.stringContaining('Compiled 1 explores, SUCCESS=0 PARTIAL_SUCCESS=1 ERRORS=0'),
|
|
135
|
+
]));
|
|
136
|
+
errorOutput.length = 0;
|
|
137
|
+
const strictResult = await (0, compile_1.compile)({
|
|
138
|
+
...getCompileOptions(tempDir),
|
|
139
|
+
partialCompilation: false,
|
|
140
|
+
});
|
|
141
|
+
expect(strictResult.filter(common_1.isExploreError)).toHaveLength(1);
|
|
142
|
+
expect(errorOutput).toEqual(expect.arrayContaining([
|
|
143
|
+
expect.stringContaining('- ERROR> test_model'),
|
|
144
|
+
expect.stringContaining('Compiled 1 explores, SUCCESS=0 ERRORS=1'),
|
|
145
|
+
]));
|
|
203
146
|
});
|
|
204
147
|
});
|
|
@@ -196,7 +196,6 @@ describe('compile warehouse column validation', () => {
|
|
|
196
196
|
});
|
|
197
197
|
});
|
|
198
198
|
afterEach(async () => {
|
|
199
|
-
vi.unstubAllEnvs();
|
|
200
199
|
vi.restoreAllMocks();
|
|
201
200
|
await promises_1.default.rm(tempDir, { recursive: true, force: true });
|
|
202
201
|
});
|
|
@@ -241,8 +240,7 @@ describe('compile warehouse column validation', () => {
|
|
|
241
240
|
});
|
|
242
241
|
describe('compile output for warehouse column warnings', () => {
|
|
243
242
|
const WAREHOUSE_WARNING = 'Warehouse rejected column reference TABLE.rolling_30d_avg_sales in model "my_model"';
|
|
244
|
-
test('renders ERROR for a warehouse rejection
|
|
245
|
-
vi.stubEnv('PARTIAL_COMPILATION_ENABLED', 'true');
|
|
243
|
+
test('renders ERROR for a warehouse rejection by default', async () => {
|
|
246
244
|
setupWarehouseClient();
|
|
247
245
|
mockProberToAppendWarning(WAREHOUSE_WARNING);
|
|
248
246
|
await (0, compile_1.compile)({
|
|
@@ -255,12 +253,12 @@ describe('compile warehouse column validation', () => {
|
|
|
255
253
|
]));
|
|
256
254
|
});
|
|
257
255
|
test('renders ERROR for a warehouse rejection when partial compilation is disabled', async () => {
|
|
258
|
-
vi.stubEnv('PARTIAL_COMPILATION_ENABLED', 'false');
|
|
259
256
|
setupWarehouseClient();
|
|
260
257
|
mockProberToAppendWarning(WAREHOUSE_WARNING);
|
|
261
258
|
const result = await (0, compile_1.compile)({
|
|
262
259
|
...baseOptions(tempDir),
|
|
263
260
|
validateWarehouseColumns: true,
|
|
261
|
+
partialCompilation: false,
|
|
264
262
|
});
|
|
265
263
|
expect(errorOutput).toEqual(expect.arrayContaining([
|
|
266
264
|
expect.stringContaining(`- ERROR> my_model : ${WAREHOUSE_WARNING}`),
|
|
@@ -319,7 +317,6 @@ describe('compile warehouse column validation', () => {
|
|
|
319
317
|
expect(deployRequest[0].body).not.toContain(common_1.InlineErrorType.WAREHOUSE_COLUMN_ERROR);
|
|
320
318
|
});
|
|
321
319
|
test('keeps generic warnings hidden when partial compilation is disabled', async () => {
|
|
322
|
-
vi.stubEnv('PARTIAL_COMPILATION_ENABLED', 'false');
|
|
323
320
|
vi.mocked(validation_1.validateDbtModel).mockResolvedValue({
|
|
324
321
|
valid: [modelWithDuplicateMetricName],
|
|
325
322
|
invalid: [],
|
|
@@ -328,6 +325,7 @@ describe('compile warehouse column validation', () => {
|
|
|
328
325
|
await (0, compile_1.compile)({
|
|
329
326
|
...baseOptions(tempDir),
|
|
330
327
|
skipWarehouseCatalog: true,
|
|
328
|
+
partialCompilation: false,
|
|
331
329
|
});
|
|
332
330
|
expect(errorOutput).toEqual(expect.arrayContaining([
|
|
333
331
|
expect.stringContaining('- SUCCESS> my_model'),
|
|
@@ -340,8 +338,7 @@ describe('compile warehouse column validation', () => {
|
|
|
340
338
|
expect.stringContaining('Skipped metric "id"'),
|
|
341
339
|
]));
|
|
342
340
|
});
|
|
343
|
-
test('renders generic warnings
|
|
344
|
-
vi.stubEnv('PARTIAL_COMPILATION_ENABLED', 'true');
|
|
341
|
+
test('renders generic warnings by default', async () => {
|
|
345
342
|
vi.mocked(validation_1.validateDbtModel).mockResolvedValue({
|
|
346
343
|
valid: [modelWithDuplicateMetricName],
|
|
347
344
|
invalid: [],
|
|
@@ -357,8 +354,7 @@ describe('compile warehouse column validation', () => {
|
|
|
357
354
|
expect.stringContaining('Compiled 1 explores, SUCCESS=0 PARTIAL_SUCCESS=1 ERRORS=0'),
|
|
358
355
|
]));
|
|
359
356
|
});
|
|
360
|
-
test('renders the warehouse error and generic warnings
|
|
361
|
-
vi.stubEnv('PARTIAL_COMPILATION_ENABLED', 'true');
|
|
357
|
+
test('renders the warehouse error and generic warnings by default', async () => {
|
|
362
358
|
vi.mocked(validation_1.validateDbtModel).mockResolvedValue({
|
|
363
359
|
valid: [modelWithDuplicateMetricName],
|
|
364
360
|
invalid: [],
|
|
@@ -381,8 +377,7 @@ describe('compile warehouse column validation', () => {
|
|
|
381
377
|
? []
|
|
382
378
|
: (explore.warnings ?? []).map((warning) => warning.type))).toEqual([common_1.InlineErrorType.DUPLICATE_FIELD_NAME]);
|
|
383
379
|
});
|
|
384
|
-
test('renders only the warehouse error when partial compilation is disabled
|
|
385
|
-
vi.stubEnv('PARTIAL_COMPILATION_ENABLED', 'false');
|
|
380
|
+
test('renders only the warehouse error when partial compilation is disabled', async () => {
|
|
386
381
|
vi.mocked(validation_1.validateDbtModel).mockResolvedValue({
|
|
387
382
|
valid: [modelWithDuplicateMetricName],
|
|
388
383
|
invalid: [],
|
|
@@ -393,6 +388,7 @@ describe('compile warehouse column validation', () => {
|
|
|
393
388
|
await (0, compile_1.compile)({
|
|
394
389
|
...baseOptions(tempDir),
|
|
395
390
|
validateWarehouseColumns: true,
|
|
391
|
+
partialCompilation: false,
|
|
396
392
|
});
|
|
397
393
|
expect(errorOutput).toEqual(expect.arrayContaining([
|
|
398
394
|
expect.stringContaining(`- ERROR> my_model : ${WAREHOUSE_WARNING}`),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/handlers/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,wBAAwB,EAGxB,OAAO,EACP,YAAY,EASf,MAAM,mBAAmB,CAAC;AA2B3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AASlD,KAAK,oBAAoB,GAAG,iBAAiB,GAAG;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,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,gBAAgB,wBAAwB,CAAC,UAAU,CAAC,GAAG,SAAS,SA0BnE,CAAC;AAiPF,eAAO,MAAM,MAAM,GACf,UAAU,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,EACpC,SAAS,UAAU,KACpB,OAAO,CAAC,IAAI,CA6Id,CAAC;AAiGF,eAAO,MAAM,aAAa,GAAU,iBAAiB,oBAAoB,kBAmKxE,CAAC"}
|
|
@@ -63,7 +63,7 @@ export declare const testHelpers: {
|
|
|
63
63
|
getDashboardChartSlugs: (dashboardSlugs: string[], customPath?: string, looseDashboards?: (DashboardAsCode & {
|
|
64
64
|
needsUpdating: boolean;
|
|
65
65
|
})[]) => Promise<string[]>;
|
|
66
|
-
|
|
66
|
+
hasContentFilters: ({ spacesOnly, charts, dashboards, agents, alerts, googleSheets, scheduledDeliveries, virtualViews, apps, }: Pick<DownloadHandlerOptions, "spacesOnly" | "charts" | "dashboards" | "agents" | "alerts" | "googleSheets" | "scheduledDeliveries" | "virtualViews" | "apps">) => boolean;
|
|
67
67
|
readAiAgentFiles: (customPath?: string) => Promise<AgentAsCode[]>;
|
|
68
68
|
readSpaceFiles: (customPath?: string) => Promise<SpaceCodeFile[]>;
|
|
69
69
|
readSpaceNames: (customPath?: string) => Promise<Record<string, string>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/handlers/download.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,WAAW,EAuBX,WAAW,EAGX,eAAe,EAef,KAAK,WAAW,EACnB,MAAM,mBAAmB,CAAC;AAY3B,OAAO,EAIH,KAAK,0BAA0B,EAClC,MAAM,iCAAiC,CAAC;AA+DzC,OAAO,EAmBH,KAAK,aAAa,EACrB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,sBAAsB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAA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B,cAAc,GACd,MAAM,CACX,KAAG,OAAO;oCA+3BM,MAAM,KACpB,OAAO,CAAC,WAAW,EAAE,CAAC;;;sCA9xBd,WAAW,oBACA,OAAO,KAC1B,WAAW;;+EAhIX,IAAI,CACH,sBAAsB,EACtB,YAAY,GAAG,eAAe,GAAG,QAAQ,GAAG,UAAU,CACzD,KAAG,OAAO;;qCA+yDC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,SACvB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC9B;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,0BAA0B,CAAA;KAAE;;oCAzjC5C,MAAM,SACV,MAAM,EAAE,WACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,SACxB,OAAO,aACH,OAAO,eACL,MAAM,KACpB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;CAqsEjC,CAAC"}
|
|
@@ -30,7 +30,7 @@ const selectProject_1 = require("./selectProject");
|
|
|
30
30
|
const spacesAsCode_1 = require("./spacesAsCode");
|
|
31
31
|
const shouldDownloadAiAgents = ({ includeAll, includeAgents, agents, appsOnly, }) => appsOnly !== true &&
|
|
32
32
|
(includeAll === true || includeAgents === true || agents.length > 0);
|
|
33
|
-
const
|
|
33
|
+
const hasContentFilters = ({ spacesOnly, charts, dashboards, agents, alerts, googleSheets, scheduledDeliveries, virtualViews, apps, }) => !spacesOnly &&
|
|
34
34
|
[
|
|
35
35
|
charts,
|
|
36
36
|
dashboards,
|
|
@@ -756,7 +756,7 @@ const downloadHandler = async (options) => {
|
|
|
756
756
|
if (options.rootSpaces && options.nested) {
|
|
757
757
|
throw new common_1.ParameterError('--root-spaces cannot be combined with --nested');
|
|
758
758
|
}
|
|
759
|
-
const hasFilters =
|
|
759
|
+
const hasFilters = hasContentFilters(options);
|
|
760
760
|
const shouldDownloadSpaces = !isOrganizationDownload && !options.skipSpaces && !hasFilters;
|
|
761
761
|
let skipEmbeddedSpaces = !hasFilters || options.skipSpaces;
|
|
762
762
|
if (shouldDownloadSpaces) {
|
|
@@ -1379,14 +1379,7 @@ const uploadHandler = async (options) => {
|
|
|
1379
1379
|
throw new common_1.ParameterError('Nothing to upload: --spaces-only cannot be combined with --skip-spaces.');
|
|
1380
1380
|
}
|
|
1381
1381
|
const isOrganizationUpload = options.organization === true;
|
|
1382
|
-
const hasFilters =
|
|
1383
|
-
(options.charts.length > 0 ||
|
|
1384
|
-
options.dashboards.length > 0 ||
|
|
1385
|
-
options.agents.length > 0 ||
|
|
1386
|
-
options.alerts.length > 0 ||
|
|
1387
|
-
options.googleSheets.length > 0 ||
|
|
1388
|
-
options.scheduledDeliveries.length > 0 ||
|
|
1389
|
-
options.virtualViews.length > 0);
|
|
1382
|
+
const hasFilters = hasContentFilters(options);
|
|
1390
1383
|
const shouldReconcileSpaces = !isOrganizationUpload && !options.skipSpaces && !hasFilters;
|
|
1391
1384
|
let preflightSpaceFiles = [];
|
|
1392
1385
|
if (shouldReconcileSpaces) {
|
|
@@ -1860,7 +1853,7 @@ exports.testHelpers = {
|
|
|
1860
1853
|
downloadSpaces: spacesAsCode_1.downloadSpaces,
|
|
1861
1854
|
getFlatSpaceFileNames: spacesAsCode_1.getFlatSpaceFileNames,
|
|
1862
1855
|
getDashboardChartSlugs,
|
|
1863
|
-
|
|
1856
|
+
hasContentFilters,
|
|
1864
1857
|
readAiAgentFiles,
|
|
1865
1858
|
readSpaceFiles: spacesAsCode_1.readSpaceFiles,
|
|
1866
1859
|
readSpaceNames: spacesAsCode_1.readSpaceNames,
|
|
@@ -13,8 +13,8 @@ vitest_1.vi.mock('./dbt/apiClient', async (importOriginal) => ({
|
|
|
13
13
|
...(await importOriginal()),
|
|
14
14
|
lightdashApi: vitest_1.vi.fn(),
|
|
15
15
|
}));
|
|
16
|
-
const { assertUniqueSpacePaths, downloadSpaces, getDashboardChartSlugs, getFlatSpaceFileNames,
|
|
17
|
-
const
|
|
16
|
+
const { assertUniqueSpacePaths, downloadSpaces, getDashboardChartSlugs, getFlatSpaceFileNames, hasContentFilters, readAiAgentFiles, readSpaceFiles, readSpaceNames, sanitizeChartForDownload, shouldFallBackToEmbeddedSpaces, shouldDownloadAiAgents, summarizeUploadChanges, upsertSpaces, upsertVirtualViews, validateSpaceIdentity, writeSpaceFiles, } = download_1.testHelpers;
|
|
17
|
+
const makeContentFilterOptions = (overrides = {}) => ({
|
|
18
18
|
spacesOnly: false,
|
|
19
19
|
charts: [],
|
|
20
20
|
dashboards: [],
|
|
@@ -26,15 +26,15 @@ const makeUploadFilterOptions = (overrides = {}) => ({
|
|
|
26
26
|
apps: [],
|
|
27
27
|
...overrides,
|
|
28
28
|
});
|
|
29
|
-
describe('
|
|
30
|
-
it('treats explicit apps as a filtered upload', () => {
|
|
31
|
-
expect(
|
|
29
|
+
describe('hasContentFilters', () => {
|
|
30
|
+
it('treats explicit apps as a filtered download and upload', () => {
|
|
31
|
+
expect(hasContentFilters(makeContentFilterOptions({ apps: ['app-reference'] }))).toBe(true);
|
|
32
32
|
});
|
|
33
|
-
it('keeps an unfiltered
|
|
34
|
-
expect(
|
|
33
|
+
it('keeps an unfiltered content operation unfiltered', () => {
|
|
34
|
+
expect(hasContentFilters(makeContentFilterOptions())).toBe(false);
|
|
35
35
|
});
|
|
36
36
|
it('does not treat content selections as filters in spaces-only mode', () => {
|
|
37
|
-
expect(
|
|
37
|
+
expect(hasContentFilters(makeContentFilterOptions({
|
|
38
38
|
spacesOnly: true,
|
|
39
39
|
apps: ['app-reference'],
|
|
40
40
|
}))).toBe(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/handlers/preview.ts"],"names":[],"mappings":"AACA,OAAO,EACH,+BAA+B,EAKlC,MAAM,mBAAmB,CAAC;AAgB3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOlD,KAAK,qBAAqB,GAAG,iBAAiB,GAAG;IAC7C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,CAAC,EAAE,OAAO,CAAC;IAC1B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AA2GF,eAAO,MAAM,cAAc,GACvB,iBAAiB,qBAAqB,KACvC,OAAO,CAAC,IAAI,CAmSd,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC5B,iBAAiB,qBAAqB,KACvC,OAAO,CAAC,IAAI,CA8Kd,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC3B,SAAS,yBAAyB,KACnC,OAAO,CAAC,IAAI,CA0Cd,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -233,6 +233,7 @@ commander_1.program
|
|
|
233
233
|
.option('--use-dbt-list [true|false]', 'Use `dbt list` instead of `dbt compile` to generate dbt manifest.json', parseUseDbtListOption, true)
|
|
234
234
|
.option('--disable-timestamp-conversion [true|false]', 'Disable timestamp conversion to UTC for Snowflake warehouses. Only use this if your timestamp values are already in UTC.', parseDisableTimestampConversionOption)
|
|
235
235
|
.option('--validate-warehouse-columns', validateWarehouseColumnsDescription, false)
|
|
236
|
+
.option('--no-partial-compilation', 'Fail when a field or join cannot be compiled instead of returning a partial explore')
|
|
236
237
|
.action(compile_1.compileHandler);
|
|
237
238
|
commander_1.program
|
|
238
239
|
.command('preview')
|
|
@@ -272,6 +273,7 @@ commander_1.program
|
|
|
272
273
|
.option('--parallel-batches <number>', 'Number of batches to send in parallel (default: 1, use higher values with caution)', '1')
|
|
273
274
|
.option('--expires-in <hours>', 'Number of hours until the preview project auto-expires (default: 720, i.e. 30 days)')
|
|
274
275
|
.option('--validate-warehouse-columns', validateWarehouseColumnsDescription, false)
|
|
276
|
+
.option('--no-partial-compilation', 'Fail when a field or join cannot be compiled instead of returning a partial explore')
|
|
275
277
|
.action(preview_1.previewHandler);
|
|
276
278
|
commander_1.program
|
|
277
279
|
.command('start-preview')
|
|
@@ -311,6 +313,7 @@ commander_1.program
|
|
|
311
313
|
.option('--parallel-batches <number>', 'Number of batches to send in parallel (default: 1, use higher values with caution)', '1')
|
|
312
314
|
.option('--expires-in <hours>', 'Number of hours until the preview project auto-expires (default: 720, i.e. 30 days)')
|
|
313
315
|
.option('--validate-warehouse-columns', validateWarehouseColumnsDescription, false)
|
|
316
|
+
.option('--no-partial-compilation', 'Fail when a field or join cannot be compiled instead of returning a partial explore')
|
|
314
317
|
.action(preview_1.startPreviewHandler);
|
|
315
318
|
commander_1.program
|
|
316
319
|
.command('stop-preview')
|
|
@@ -369,7 +372,7 @@ const downloadCommand = commander_1.program
|
|
|
369
372
|
.option('--include-scheduled-deliveries', 'include all scheduled deliveries in the download', false)
|
|
370
373
|
.option('--include-all', 'include all optional content in the download', false)
|
|
371
374
|
.option('--strip-pivot-series', 'strip per-value pivot series config from chart YAML for portable downloads', false)
|
|
372
|
-
.option('--apps <appReferences...>', '
|
|
375
|
+
.option('--apps <appReferences...>', 'Download only specified data apps by UUID or URL (enterprise). Works for apps not added to a space.')
|
|
373
376
|
.option('--include-apps', "Include all of the project's data apps (enterprise), capped at --apps-limit (default: 50)", false)
|
|
374
377
|
.option('--apps-limit <number>', 'Maximum number of data apps downloaded by --include-apps or --include-all (default: 50)', undefined)
|
|
375
378
|
.option('--apps-only', 'Download only data apps (implies --skip-charts --skip-dashboards --skip-spaces). Requires --apps <appReferences...>, --include-apps, or --include-all.', false)
|
|
@@ -403,7 +406,7 @@ const uploadCommand = commander_1.program
|
|
|
403
406
|
.option('--include-charts', 'Include charts updates when uploading dashboards', false)
|
|
404
407
|
.option('--validate', 'Validate charts and dashboards after upload', false)
|
|
405
408
|
.option('--gzip', 'Enable gzip compression for request bodies', false)
|
|
406
|
-
.option('--apps <appReferences...>', 'Upload
|
|
409
|
+
.option('--apps <appReferences...>', 'Upload only specified data apps by UUID or URL (enterprise).')
|
|
407
410
|
.option('--include-apps', 'Upload all app folders on disk (enterprise).', false)
|
|
408
411
|
.option('--create-new', 'Always create a new app from the uploaded code instead of updating the app referenced by lightdash-app.yml.', false)
|
|
409
412
|
.option('--organization', 'upload all organization-scoped resources without selecting a project', false)
|
|
@@ -447,6 +450,7 @@ commander_1.program
|
|
|
447
450
|
.option('--parallel-batches <number>', 'Number of batches to send in parallel (default: 1, use higher values with caution)', '1')
|
|
448
451
|
.option('--gzip', 'Enable gzip compression for request bodies', false)
|
|
449
452
|
.option('--validate-warehouse-columns', validateWarehouseColumnsDescription, false)
|
|
453
|
+
.option('--no-partial-compilation', 'Fail when a field or join cannot be compiled instead of returning a partial explore')
|
|
450
454
|
.action(deploy_1.deployHandler);
|
|
451
455
|
commander_1.program
|
|
452
456
|
.command('refresh')
|
|
@@ -490,6 +494,7 @@ commander_1.program
|
|
|
490
494
|
.option('--validate-warehouse-columns', `${validateWarehouseColumnsDescription} Only applies when tables are validated.`, false)
|
|
491
495
|
.option('--include-spaces <spaceSlugs...>', 'Only report validation errors for charts and dashboards in these spaces (and their sub-spaces). Spaces must be visible to your credentials')
|
|
492
496
|
.option('--exclude-spaces <spaceSlugs...>', 'Skip validation errors for charts and dashboards in these spaces (and their sub-spaces). Spaces must be visible to your credentials')
|
|
497
|
+
.option('--no-partial-compilation', 'Fail when a field or join cannot be compiled instead of returning a partial explore')
|
|
493
498
|
.action(validate_1.validateHandler);
|
|
494
499
|
commander_1.program
|
|
495
500
|
.command('generate')
|