Skip to content

Not able to configure for Promises with Tables import from csv. #14

@jyotirmay123

Description

@jyotirmay123

I was trying to import data from csv file and dump it onto mysql database. That is working correctly. Now I want to resolve a promise when the execution is done for data dump.
I am using below code to do so, I tried different stuff to get into end point and placing the resolve call there, but did not work out.
Please help me how to return a promise with data dum complete.

var csvToMysql = {
    import_: function (filePath, table) {
        return new Promise((resolve, reject) => {
           let tbl = new Tables({
                input: filePath,
                inputType: "csv",
                db: "mysql://" + mysql.user + ":" + mysql.password + "@" + mysql.host + ":" + mysql.port + 
                        "/" + mysql.database,
                tableName: table,
                errorHandler: reject,
                successHandler : resolve  // Is there any such option or if any other way??
            });
       }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions