Closed janro1 closed 1 year ago
this has been implemented in 3.2.0 release . See importFile method : without connection
try {
await mariadb.importFile({ host: 'localhost', user: 'root', file: '/tmp/tools/data-dump.sql'});
} catch (e) {
// ...
}
try {
await conn.importFile({
file: '/tmp/someFile.sql',
database: 'myDb'
});
} catch (e) {
// ...
}
or from a pool:
try {
await pool.importFile({
file: '/tmp/someFile.sql',
database: 'myDb'
});
} catch (e) {
// ...
}
It would be good if the client could read sql files to restore backups for example, because in some environments it is difficult to install binaries. This is for example the case in AWS lambda.
Or maybe there is already a way that I missed in the documentation?