dbgate/test/importTable.js

28 lines
607 B
JavaScript
Raw Normal View History

2020-06-10 19:35:25 +00:00
const dbgateApi = require('@dbgate/api');
async function run() {
const csvReader = await dbgateApi.csvReader({
fileName: 'test.csv',
2020-06-11 08:19:38 +00:00
// header: false,
2020-06-10 19:35:25 +00:00
});
2020-06-11 08:19:38 +00:00
// const tableWriter = await dbgateApi.tableWriter({
// connection: {
// server: 'localhost',
// engine: 'mysql',
// user: 'root',
// password: 'test',
// port: '3307',
// database: 'Chinook',
// },
// pureName: 'importedTable'
// });
2020-06-10 19:35:25 +00:00
const consoleWriter = await dbgateApi.consoleObjectWriter();
await dbgateApi.copyStream(csvReader, consoleWriter);
}
dbgateApi.runScript(run);