From 1072f176aafef6a8b35e655ec22df7b6809dfbae Mon Sep 17 00:00:00 2001 From: Tushar <30565750+tushar5526@users.noreply.github.com> Date: Tue, 5 Sep 2023 18:22:45 +0530 Subject: [PATCH 1/2] fix: Log an error if "id" is used as a column name --- .../dimension-grammar/dimension-grammar.service.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/impl/c-qube/src/services/csv-adapter/parser/dimension-grammar/dimension-grammar.service.ts b/impl/c-qube/src/services/csv-adapter/parser/dimension-grammar/dimension-grammar.service.ts index 9594f9a1..8c8af755 100644 --- a/impl/c-qube/src/services/csv-adapter/parser/dimension-grammar/dimension-grammar.service.ts +++ b/impl/c-qube/src/services/csv-adapter/parser/dimension-grammar/dimension-grammar.service.ts @@ -28,7 +28,14 @@ export class DimensionGrammarService { const dimensionName = getDimensionNameFromFilePath(csvFilePath); const { pk, indexes } = getPrimaryKeyAndIndexes(row1, row3); const dimensionColumns = getDimensionColumns(row2, row3); - + dimensionColumns.forEach((column) => { + if (column.name === 'id') { + this.logger.error( + `Cannot use reserved word 'id'. Invalid column name for dimension grammar file: ${csvFilePath}`, + ); + return null; + } + }); const dimensionGrammar = this.createCompositeDimensionGrammar( dimensionColumns, dimensionName, From 2b2806ec1d21bb759e4ef678466f12e129919b48 Mon Sep 17 00:00:00 2001 From: Tushar <30565750+tushar5526@users.noreply.github.com> Date: Tue, 5 Sep 2023 18:26:26 +0530 Subject: [PATCH 2/2] Columns are case insensitive --- .../parser/dimension-grammar/dimension-grammar.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impl/c-qube/src/services/csv-adapter/parser/dimension-grammar/dimension-grammar.service.ts b/impl/c-qube/src/services/csv-adapter/parser/dimension-grammar/dimension-grammar.service.ts index 8c8af755..a7e74659 100644 --- a/impl/c-qube/src/services/csv-adapter/parser/dimension-grammar/dimension-grammar.service.ts +++ b/impl/c-qube/src/services/csv-adapter/parser/dimension-grammar/dimension-grammar.service.ts @@ -29,7 +29,7 @@ export class DimensionGrammarService { const { pk, indexes } = getPrimaryKeyAndIndexes(row1, row3); const dimensionColumns = getDimensionColumns(row2, row3); dimensionColumns.forEach((column) => { - if (column.name === 'id') { + if (column.name.toLowerCase() === 'id') { this.logger.error( `Cannot use reserved word 'id'. Invalid column name for dimension grammar file: ${csvFilePath}`, );