@lightdash/cli 0.2216.0 → 0.2218.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.
@@ -9,6 +9,7 @@ export type CompileHandlerOptions = DbtCompileOptions & {
9
9
  verbose: boolean;
10
10
  startOfWeek?: number;
11
11
  warehouseCredentials?: boolean;
12
+ disableTimestampConversion?: boolean;
12
13
  };
13
14
  export declare const compile: (options: CompileHandlerOptions) => Promise<(Explore | ExploreError)[]>;
14
15
  export declare const compileHandler: (originalOptions: CompileHandlerOptions) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/handlers/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,OAAO,EACP,YAAY,EAUf,MAAM,mBAAmB,CAAC;AAY3B,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;CAClC,CAAC;AAyDF,eAAO,MAAM,OAAO,YAAmB,qBAAqB,wCAmL3D,CAAC;AACF,eAAO,MAAM,cAAc,oBACN,qBAAqB,kBAuBzC,CAAC"}
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/handlers/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,OAAO,EACP,YAAY,EAUf,MAAM,mBAAmB,CAAC;AAY3B,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;CACxC,CAAC;AA2DF,eAAO,MAAM,OAAO,YAAmB,qBAAqB,wCAqL3D,CAAC;AACF,eAAO,MAAM,cAAc,oBACN,qBAAqB,kBAuBzC,CAAC"}
@@ -17,7 +17,7 @@ const styles = tslib_1.__importStar(require("../styles"));
17
17
  const compile_1 = require("./dbt/compile");
18
18
  const getDbtVersion_1 = require("./dbt/getDbtVersion");
19
19
  const getWarehouseClient_1 = tslib_1.__importDefault(require("./dbt/getWarehouseClient"));
20
- const getExploresFromLightdashYmlProject = async (projectDir, lightdashProjectConfig, startOfWeek) => {
20
+ const getExploresFromLightdashYmlProject = async (projectDir, lightdashProjectConfig, startOfWeek, disableTimestampConversion) => {
21
21
  // Try to load Lightdash YAML models
22
22
  const lightdashModels = await (0, loader_1.loadLightdashModels)(projectDir);
23
23
  if (lightdashModels.length === 0) {
@@ -39,7 +39,7 @@ const getExploresFromLightdashYmlProject = async (projectDir, lightdashProjectCo
39
39
  }
40
40
  globalState_1.default.debug('> Skipping warehouse catalog (types in YAML)');
41
41
  const warehouseSqlBuilder = (0, warehouses_1.warehouseSqlBuilderFromType)(adapterType, startOfWeek);
42
- const validExplores = await (0, common_1.convertExplores)(validModels, false, warehouseSqlBuilder.getAdapterType(), [], warehouseSqlBuilder, lightdashProjectConfig);
42
+ const validExplores = await (0, common_1.convertExplores)(validModels, false, warehouseSqlBuilder.getAdapterType(), [], warehouseSqlBuilder, lightdashProjectConfig, disableTimestampConversion);
43
43
  return validExplores;
44
44
  };
45
45
  const compile = async (options) => {
@@ -65,7 +65,7 @@ const compile = async (options) => {
65
65
  // Try lightdash project compile
66
66
  let explores = null;
67
67
  let dbtMetrics = null;
68
- explores = await getExploresFromLightdashYmlProject(absoluteProjectPath, lightdashProjectConfig, options.startOfWeek);
68
+ explores = await getExploresFromLightdashYmlProject(absoluteProjectPath, lightdashProjectConfig, options.startOfWeek, options.disableTimestampConversion);
69
69
  // Load dbt Project
70
70
  if (explores === null) {
71
71
  const context = await (0, context_1.getDbtContext)({
@@ -121,7 +121,7 @@ const compile = async (options) => {
121
121
  common_1.DbtManifestVersion.V12,
122
122
  ].includes(manifestVersion)
123
123
  ? []
124
- : Object.values(manifest.metrics || {}), warehouseSqlBuilder, lightdashProjectConfig);
124
+ : Object.values(manifest.metrics || {}), warehouseSqlBuilder, lightdashProjectConfig, options.disableTimestampConversion);
125
125
  console.error('');
126
126
  explores = [...validExplores, ...failedExplores];
127
127
  dbtMetrics = manifest.metrics;
package/dist/index.js CHANGED
@@ -44,6 +44,12 @@ function parseUseDbtListOption(value) {
44
44
  }
45
45
  return value.toLowerCase() !== 'false';
46
46
  }
47
+ function parseDisableTimestampConversionOption(value) {
48
+ if (value === undefined) {
49
+ return false;
50
+ }
51
+ return value.toLowerCase() === 'true';
52
+ }
47
53
  function parseProjectArgument(value) {
48
54
  if (value === undefined) {
49
55
  throw new commander_1.InvalidArgumentError('No project argument provided.');
@@ -157,6 +163,7 @@ commander_1.program
157
163
  .option('--defer', 'dbt property. Resolve unselected nodes by deferring to the manifest within the --state directory.', undefined)
158
164
  .option('--no-defer', 'dbt property. Do not resolve unselected nodes by deferring to the manifest within the --state directory.', undefined)
159
165
  .option('--no-warehouse-credentials', 'Compile without any warehouse credentials. Skips dbt compile + warehouse catalog')
166
+ .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, false)
160
167
  .action(compile_1.compileHandler);
161
168
  commander_1.program
162
169
  .command('preview')
@@ -186,7 +193,9 @@ commander_1.program
186
193
  .option('--ignore-errors', 'Allows deploy with errors on compile', false)
187
194
  .option('--table-configuration <prod|all>', `If set to 'prod' it will copy the table configuration from prod project`, 'all')
188
195
  .option('--skip-copy-content', 'Skip copying content from the source project', false)
196
+ .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, false)
189
197
  .option('--organization-credentials <name>', 'Use organization warehouse credentials with the specified name (Enterprise Edition feature)')
198
+ .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, false)
190
199
  .action(preview_1.previewHandler);
191
200
  commander_1.program
192
201
  .command('start-preview')
@@ -216,6 +225,7 @@ commander_1.program
216
225
  .option('--ignore-errors', 'Allows deploy with errors on compile', false)
217
226
  .option('--table-configuration <prod|all>', `If set to 'prod' it will copy the table configuration from prod project`, 'all')
218
227
  .option('--skip-copy-content', 'Skip copying content from the source project', false)
228
+ .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, false)
219
229
  .action(preview_1.startPreviewHandler);
220
230
  commander_1.program
221
231
  .command('stop-preview')
@@ -272,6 +282,7 @@ commander_1.program
272
282
  .option('--use-dbt-list [true|false]', 'Use `dbt list` instead of `dbt compile` to generate dbt manifest.json', parseUseDbtListOption, true)
273
283
  .option('--no-warehouse-credentials', 'Create project without warehouse credentials. Skips dbt compile + warehouse catalog')
274
284
  .option('--organization-credentials <name>', 'Use organization warehouse credentials with the specified name (Enterprise Edition feature)')
285
+ .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, false)
275
286
  .action(deploy_1.deployHandler);
276
287
  commander_1.program
277
288
  .command('refresh')
@@ -305,6 +316,7 @@ commander_1.program
305
316
  .option('--skip-dbt-compile', 'Skip `dbt compile` and deploy from the existing ./target/manifest.json', false)
306
317
  .option('--skip-warehouse-catalog', 'Skip fetch warehouse catalog and use types in yml', false)
307
318
  .option('--use-dbt-list [true|false]', 'Use `dbt list` instead of `dbt compile` to generate dbt manifest.json', parseUseDbtListOption, true)
319
+ .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, false)
308
320
  .addOption(new commander_1.Option('--only <elems...>', 'Specify project elements to validate')
309
321
  .choices(Object.values(common_1.ValidationTarget))
310
322
  .default(Object.values(common_1.ValidationTarget)))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "0.2216.0",
3
+ "version": "0.2218.0",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "lightdash": "dist/index.js"
@@ -34,8 +34,8 @@
34
34
  "unique-names-generator": "^4.7.1",
35
35
  "uuid": "^11.0.3",
36
36
  "yaml": "^2.7.0",
37
- "@lightdash/warehouses": "0.2216.0",
38
- "@lightdash/common": "0.2216.0"
37
+ "@lightdash/common": "0.2218.0",
38
+ "@lightdash/warehouses": "0.2218.0"
39
39
  },
40
40
  "description": "Lightdash CLI tool",
41
41
  "devDependencies": {