mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 21:26:00 +00:00
new streams
This commit is contained in:
@@ -17,9 +17,13 @@ async function run() {
|
||||
|
||||
const csvWriter = await dbgateApi.csvWriter({
|
||||
fileName: 'test.csv',
|
||||
header: true,
|
||||
});
|
||||
|
||||
const consoleWriter = await dbgateApi.consoleObjectWriter();
|
||||
|
||||
await dbgateApi.copyStream(queryReader, csvWriter);
|
||||
// await dbgateApi.copyStream(queryReader, consoleWriter);
|
||||
}
|
||||
|
||||
dbgateApi.runScript(run);
|
||||
|
||||
27
test/importTable.js
Normal file
27
test/importTable.js
Normal 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);
|
||||
@@ -1,25 +1,7 @@
|
||||
1,Rock
|
||||
2,Jazz
|
||||
3,Metal
|
||||
4,Alternative & Punk
|
||||
5,Rock And Roll
|
||||
6,Blues
|
||||
7,Latin
|
||||
8,Reggae
|
||||
9,Pop
|
||||
10,Soundtrack
|
||||
11,Bossa Nova
|
||||
12,Easy Listening
|
||||
13,Heavy Metal
|
||||
14,R&B/Soul
|
||||
15,Electronica/Dance
|
||||
16,World
|
||||
17,Hip Hop/Rap
|
||||
18,Science Fiction
|
||||
19,TV Shows
|
||||
20,Sci Fi & Fantasy
|
||||
21,Drama
|
||||
22,Comedy
|
||||
23,Alternative
|
||||
24,Classical
|
||||
25,Opera
|
||||
id,country
|
||||
1,Czechia
|
||||
2,Austria
|
||||
3,Germany
|
||||
4,Romania
|
||||
5,Great Britain
|
||||
6,"Bosna, Hecegovina"
|
||||
|
||||
|
Reference in New Issue
Block a user