@lightdash/cli 0.3473.0 → 0.3475.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.
@@ -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,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAChC,SAAS,OAAO,GAAG,YAAY,KAChC,OAIW,CAAC;AAEf,eAAO,MAAM,0BAA0B,GACnC,SAAS,OAAO,GAAG,YAAY,KAChC,OAAO,GAAG,YAiBZ,CAAC;AAwNF,eAAO,MAAM,OAAO,GAAU,SAAS,qBAAqB,wCAgU3D,CAAC;AAEF,eAAO,MAAM,cAAc,GACvB,iBAAiB,qBAAqB,kBAmCzC,CAAC"}
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,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAChC,SAAS,OAAO,GAAG,YAAY,KAChC,OAIW,CAAC;AAEf,eAAO,MAAM,0BAA0B,GACnC,SAAS,OAAO,GAAG,YAAY,KAChC,OAAO,GAAG,YAiBZ,CAAC;AA+NF,eAAO,MAAM,OAAO,GAAU,SAAS,qBAAqB,wCAiU3D,CAAC;AAEF,eAAO,MAAM,cAAc,GACvB,iBAAiB,qBAAqB,kBAmCzC,CAAC"}
@@ -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 = process.env.PARTIAL_COMPILATION_ENABLED !== 'false'
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: process.env.PARTIAL_COMPILATION_ENABLED !== 'false',
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(absoluteProjectPath, lightdashProjectConfig, options.startOfWeek, options.disableTimestampConversion);
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: process.env.PARTIAL_COMPILATION_ENABLED !== 'false',
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 styles = tslib_1.__importStar(require("../styles"));
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
- expect(startedCall).toBeDefined();
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 display PARTIAL_SUCCESS with warning messages', () => {
93
- // Mock console.error to capture output
94
- const consoleSpy = vi
95
- .spyOn(console, 'error')
96
- .mockImplementation(() => { });
97
- // Partial compilation is now enabled by default
98
- const originalEnv = process.env.PARTIAL_COMPILATION_ENABLED;
99
- // No need to set to 'true' as it's enabled by default
100
- try {
101
- // Create mock explores array with different statuses
102
- const mockExplores = [
103
- {
104
- name: 'successful_explore',
105
- label: 'Successful Explore',
106
- tags: [],
107
- baseTable: 'table1',
108
- // No warnings or errors - should be SUCCESS
109
- },
110
- {
111
- name: 'explore_with_warnings',
112
- label: 'Explore with Warnings',
113
- tags: [],
114
- baseTable: 'table2',
115
- warnings: [
116
- {
117
- type: 'MISSING_TABLE',
118
- message: 'Join to table "missing_table" was skipped',
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 when partial compilation is enabled', async () => {
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 when partial compilation is enabled', async () => {
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 when partial compilation is enabled', async () => {
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 and generic warnings exist', async () => {
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}`),
@@ -19,6 +19,7 @@ type DeployHandlerOptions = DbtCompileOptions & {
19
19
  gzip?: boolean;
20
20
  disableTimestampConversion?: boolean;
21
21
  validateWarehouseColumns: boolean;
22
+ partialCompilation?: boolean;
22
23
  };
23
24
  type DeployArgs = DeployHandlerOptions & {
24
25
  projectUuid: string;
@@ -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,O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AAuB,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,KAAK,UAAU,GAAG,oBAAoB,GAAG;IACrC,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC1B,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"}
@@ -20,6 +20,7 @@ type PreviewHandlerOptions = DbtCompileOptions & {
20
20
  expiresIn?: string;
21
21
  disableTimestampConversion?: boolean;
22
22
  validateWarehouseColumns: boolean;
23
+ partialCompilation?: boolean;
23
24
  };
24
25
  type StopPreviewHandlerOptions = {
25
26
  name: string;
@@ -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,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B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ACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,EAAE,+BAA+B,CAAC;IACpD,eAAe,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')
@@ -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')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "0.3473.0",
3
+ "version": "0.3475.0",
4
4
  "description": "Lightdash CLI tool",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -41,8 +41,8 @@
41
41
  "unique-names-generator": "4.7.1",
42
42
  "uuid": "11.1.1",
43
43
  "yaml": "2.8.3",
44
- "@lightdash/common": "0.3473.0",
45
- "@lightdash/warehouses": "0.3473.0"
44
+ "@lightdash/common": "0.3475.0",
45
+ "@lightdash/warehouses": "0.3475.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/inquirer": "8.2.4",