I want to import csv file data into mysql database table I can do it using only mysql query but I am not able to do it by sequelize and express js please help me. Thanks in advance.
1 Answer
you need to use seeders. see the docs here on making and running seeds http://docs.sequelizejs.com/manual/migrations.html#creating-first-seed
you also need to convert your CSV to SQL. see here https://blog.sqlizer.io/posts/convert-csv-to-sql/
The format for RAW SQL in your seeder is listed below
module.exports = {
up: queryInterface => queryInterface.sequelize.query(`
// RAW QUERY HERE
`),
};
,,,