This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
'use strict'; | |
// Stream unlimited rows into a Sql Server table. | |
// WARNING!!! WE DROP and RE-CREATE the table. Then stream the data into it. | |
// Source stream must be an object stream. Object property names must match | |
// table column names. Since SQL Server isn't case sensitive, don't think case |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Readable = require('stream').Readable; | |
// Easily turn anything into a readable stream. | |
// This is pretty much taken verbatim from the node documentation. Why re-invent | |
// the wheel? | |
// https://nodejs.org/api/stream.html#stream_readable_push_chunk_encoding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// This is a working example of a readable stream sending rows to insert into | |
// SQL Server. | |
const Readable = require('stream').Readable; | |
const mssql = require('mssql'); | |
const MsSqlStreamInsert = require('../../lib/source/mssql-stream-insert'); | |
const showProgress = require('../../lib/transform/show-progress')(); | |
const options = require('../../.config'); |