-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement FKSearch #131
base: jharkhand
Are you sure you want to change the base?
Implement FKSearch #131
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ const fs = require('fs').promises; | |
|
||
import * as csv from 'csv-parser'; | ||
|
||
const configPath = 'ingest/config.json'; | ||
export async function readCSV(filePath: string): Promise<string[][]> { | ||
return new Promise((resolve, reject) => { | ||
const rows: string[][] = []; | ||
|
@@ -11,7 +12,11 @@ export async function readCSV(filePath: string): Promise<string[][]> { | |
.createReadStream(filePath) | ||
.pipe(csv({ separator: ',', headers: false, quote: "'" })) | ||
.on('data', (data) => { | ||
rows.push(Object.values(data)); | ||
const rowValues: string[] = Object.values(data); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this doing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how is this logic ensuring that case insesitivity is achieved? What if the dimensions table has a value "CQUBE" and |
||
const processedRowValues = FKvalue(configPath) | ||
? rowValues | ||
: rowValues.map((value) => value.toLowerCase()); | ||
rows.push(processedRowValues); | ||
}) | ||
.on('end', () => { | ||
resolve(rows); | ||
|
@@ -30,3 +35,9 @@ export async function readCSVFile(filePath: string): Promise<string[]> { | |
.map((row: string) => row.trim()) | ||
.filter((row: string) => row !== ''); | ||
} | ||
|
||
export function FKvalue(configPath: string): boolean { | ||
const configContent = fs1.readFileSync(configPath, 'utf-8'); | ||
const config = JSON.parse(configContent); | ||
return config.globals.caseSensitiveFKSearch || false ; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
1,John,30 | ||
2,David,25 | ||
3,Michael,22 | ||
4,mary,28 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't let the
onlyCreateWhiteList
changes come into this PR.