new streams

This commit is contained in:
Jan Prochazka
2020-06-10 21:35:25 +02:00
parent 26120969de
commit 1695fb2fd8
7 changed files with 77 additions and 27 deletions

27
test/importTable.js Normal file
View File

@@ -0,0 +1,27 @@
const dbgateApi = require('@dbgate/api');
async function run() {
const csvReader = await dbgateApi.csvReader({
fileName: 'test.csv',
header: true,
});
const tableWriter = await dbgateApi.tableWriter({
connection: {
server: 'localhost',
engine: 'mysql',
user: 'root',
password: 'test',
port: '3307',
database: 'Chinook',
},
pureName: 'importedTable'
});
const consoleWriter = await dbgateApi.consoleObjectWriter();
await dbgateApi.copyStream(csvReader, consoleWriter);
}
dbgateApi.runScript(run);