mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 21:26:00 +00:00
json lines reader, writer
This commit is contained in:
@@ -31,9 +31,15 @@ async function run() {
|
||||
// header: false,
|
||||
});
|
||||
|
||||
const jsonWriter = await dbgateApi.jsonLinesWriter({
|
||||
fileName: 'test.jsonl',
|
||||
header: false,
|
||||
});
|
||||
|
||||
const consoleWriter = await dbgateApi.consoleObjectWriter();
|
||||
|
||||
await dbgateApi.copyStream(queryReader, csvWriter);
|
||||
// await dbgateApi.copyStream(queryReader, csvWriter);
|
||||
await dbgateApi.copyStream(queryReader, jsonWriter);
|
||||
// await dbgateApi.copyStream(queryReader, consoleWriter);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,11 @@ async function run() {
|
||||
sheetName: 'Events',
|
||||
});
|
||||
|
||||
const jsonReader = await dbgateApi.jsonLinesReader({
|
||||
fileName: 'test.jsonl',
|
||||
header: false,
|
||||
});
|
||||
|
||||
const tableWriter = await dbgateApi.tableWriter({
|
||||
connection: {
|
||||
server: 'localhost',
|
||||
@@ -20,7 +25,7 @@ async function run() {
|
||||
database: 'Chinook',
|
||||
},
|
||||
schemaName: 'dbo',
|
||||
pureName: 'Events',
|
||||
pureName: 'Genre3',
|
||||
createIfNotExists: true,
|
||||
truncate: true,
|
||||
});
|
||||
@@ -40,7 +45,7 @@ async function run() {
|
||||
const consoleWriter = await dbgateApi.consoleObjectWriter();
|
||||
|
||||
// await dbgateApi.copyStream(excelReader, consoleWriter);
|
||||
await dbgateApi.copyStream(excelReader, tableWriter);
|
||||
await dbgateApi.copyStream(jsonReader, tableWriter);
|
||||
// await dbgateApi.copyStream(csvReader, consoleWriter);
|
||||
// await dbgateApi.copyStream(csvReader, tableWriter);
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
GenreId,Name
|
||||
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
|
||||
|
||||
|
25
test/test.jsonl
Normal file
25
test/test.jsonl
Normal file
@@ -0,0 +1,25 @@
|
||||
{"GenreId":1,"Name":"Rock"}
|
||||
{"GenreId":2,"Name":"Jazz"}
|
||||
{"GenreId":3,"Name":"Metal"}
|
||||
{"GenreId":4,"Name":"Alternative & Punk"}
|
||||
{"GenreId":5,"Name":"Rock And Roll"}
|
||||
{"GenreId":6,"Name":"Blues"}
|
||||
{"GenreId":7,"Name":"Latin"}
|
||||
{"GenreId":8,"Name":"Reggae"}
|
||||
{"GenreId":9,"Name":"Pop"}
|
||||
{"GenreId":10,"Name":"Soundtrack"}
|
||||
{"GenreId":11,"Name":"Bossa Nova"}
|
||||
{"GenreId":12,"Name":"Easy Listening"}
|
||||
{"GenreId":13,"Name":"Heavy Metal"}
|
||||
{"GenreId":14,"Name":"R&B/Soul"}
|
||||
{"GenreId":15,"Name":"Electronica/Dance"}
|
||||
{"GenreId":16,"Name":"World"}
|
||||
{"GenreId":17,"Name":"Hip Hop/Rap"}
|
||||
{"GenreId":18,"Name":"Science Fiction"}
|
||||
{"GenreId":19,"Name":"TV Shows"}
|
||||
{"GenreId":20,"Name":"Sci Fi & Fantasy"}
|
||||
{"GenreId":21,"Name":"Drama"}
|
||||
{"GenreId":22,"Name":"Comedy"}
|
||||
{"GenreId":23,"Name":"Alternative"}
|
||||
{"GenreId":24,"Name":"Classical"}
|
||||
{"GenreId":25,"Name":"Opera"}
|
||||
Reference in New Issue
Block a user