@lightdash/cli 0.1627.1 → 0.1628.1

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.
@@ -12,8 +12,9 @@ type CompiledModel = {
12
12
  type GetDatabaseTableForModelArgs = {
13
13
  model: CompiledModel;
14
14
  warehouseClient: WarehouseClient;
15
+ preserveColumnCase: boolean;
15
16
  };
16
- export declare const getWarehouseTableForModel: ({ model, warehouseClient, }: GetDatabaseTableForModelArgs) => Promise<WarehouseTableSchema>;
17
+ export declare const getWarehouseTableForModel: ({ model, warehouseClient, preserveColumnCase, }: GetDatabaseTableForModelArgs) => Promise<WarehouseTableSchema>;
17
18
  export declare const isDocBlock: (text?: string | undefined) => boolean;
18
19
  type FindAndUpdateModelYamlArgs = {
19
20
  model: CompiledModel;
@@ -9,7 +9,7 @@ const path = tslib_1.__importStar(require("path"));
9
9
  const globalState_1 = tslib_1.__importDefault(require("../globalState"));
10
10
  const styles = tslib_1.__importStar(require("../styles"));
11
11
  const schema_1 = require("./schema");
12
- const getWarehouseTableForModel = async ({ model, warehouseClient, }) => {
12
+ const getWarehouseTableForModel = async ({ model, warehouseClient, preserveColumnCase, }) => {
13
13
  const tableRef = {
14
14
  database: model.database,
15
15
  schema: model.schema,
@@ -26,7 +26,8 @@ const getWarehouseTableForModel = async ({ model, warehouseClient, }) => {
26
26
  throw new common_1.ParseError(`Expected to find materialised model at ${tableRef.database}.${tableRef.schema}.${tableRef.table} but couldn't find (or cannot access) ${missing}`);
27
27
  }
28
28
  return Object.entries(table).reduce((accumulator, [key, value]) => {
29
- accumulator[key.toLowerCase()] = value;
29
+ const columnName = preserveColumnCase ? key : key.toLowerCase();
30
+ accumulator[columnName] = value;
30
31
  return accumulator;
31
32
  }, {});
32
33
  };
@@ -7,6 +7,7 @@ type DbtRunHandlerOptions = DbtCompileOptions & {
7
7
  verbose: boolean;
8
8
  assumeYes: boolean;
9
9
  assumeNo: boolean;
10
+ preserveColumnCase: boolean;
10
11
  };
11
12
  export declare const dbtRunHandler: (options: DbtRunHandlerOptions, command: Command) => Promise<void>;
12
13
  export {};
@@ -51,6 +51,7 @@ const dbtRunHandler = async (options, command) => {
51
51
  await (0, generate_1.generateHandler)({
52
52
  ...options,
53
53
  excludeMeta: options.excludeMeta,
54
+ preserveColumnCase: options.preserveColumnCase,
54
55
  });
55
56
  }
56
57
  };
@@ -6,6 +6,7 @@ type GenerateHandlerOptions = CompileHandlerOptions & {
6
6
  assumeYes: boolean;
7
7
  excludeMeta: boolean;
8
8
  skipExisting?: boolean;
9
+ preserveColumnCase: boolean;
9
10
  };
10
11
  export declare const generateHandler: (options: GenerateHandlerOptions) => Promise<void>;
11
12
  export {};
@@ -77,6 +77,7 @@ const generateHandler = async (options) => {
77
77
  const table = await (0, models_1.getWarehouseTableForModel)({
78
78
  model: compiledModel,
79
79
  warehouseClient,
80
+ preserveColumnCase: options.preserveColumnCase,
80
81
  });
81
82
  const { updatedYml, outputFilePath } = await (0, models_1.findAndUpdateModelYaml)({
82
83
  model: compiledModel,
package/dist/index.js CHANGED
@@ -130,6 +130,7 @@ ${styles.bold('Examples:')}
130
130
  .option('--verbose', undefined, false)
131
131
  .option('-y, --assume-yes', 'assume yes to prompts', false)
132
132
  .option('-no, --assume-no', 'assume no to prompts', false)
133
+ .option('--preserve-column-case', 'preserve original casing of column names in generated schema files', false)
133
134
  .action(run_1.dbtRunHandler);
134
135
  commander_1.program
135
136
  .command('compile')
@@ -313,6 +314,7 @@ ${styles.bold('Examples:')}
313
314
  .option('-y, --assume-yes', 'assume yes to prompts', false)
314
315
  .option('--skip-existing', 'skip files that already exist', false)
315
316
  .option('--exclude-meta', 'exclude Lightdash metadata from the generated .yml', false)
317
+ .option('--preserve-column-case', 'preserve original casing of column names in generated schema files', false)
316
318
  .option('--verbose', undefined, false)
317
319
  .action(generate_1.generateHandler);
318
320
  commander_1.program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "0.1627.1",
3
+ "version": "0.1628.1",
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.1627.1",
34
- "@lightdash/warehouses": "0.1627.1"
33
+ "@lightdash/common": "0.1628.1",
34
+ "@lightdash/warehouses": "0.1628.1"
35
35
  },
36
36
  "description": "Lightdash CLI tool",
37
37
  "devDependencies": {