Skip to content
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

improve beginSQLInsert #59

Closed
wants to merge 1 commit into from
Closed

improve beginSQLInsert #59

wants to merge 1 commit into from

Conversation

furkan-kayis
Copy link

Fixes #58

@@ -37,9 +37,7 @@ async function readCSV(csvFileName = "", batchSize: number = 0) {
});
const linesArray = data.split(/\r|\n/).filter((line) => line);
const columnNames = linesArray?.shift()?.split(",") || [];
let beginSQLInsert = `INSERT INTO ${fileAndTableName} (`;
columnNames.forEach((name) => (beginSQLInsert += `${name}, `));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should check again whether columnNames exists or not.
after that, you can perform your forEach loop.

@qurashi-akeel
Copy link

This is already marked complete in #42

@furkan-kayis furkan-kayis deleted the improve-beginSqlInsert branch January 9, 2024 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve beginSQLInsert using array.join
4 participants