Name: jts-sql-js
Owner: Open Knowledge International
Description: Library for converting JSON Table Schema to an SQL table, for Node and the browser.
Created: 2015-09-28 06:57:06.0
Updated: 2018-02-09 06:20:47.0
Pushed: 2015-10-17 21:13:15.0
Homepage: https://www.npmjs.com/package/jts-sql-js
Size: 156
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Library for converting JSON Table Schema to an SQL table, for Node and the browser.
Here's an example of using jts-sql-js
:
Sequelize = require('sequelize');
SchemaTable = require('jts-sql-js').SchemaTable;
streamify = require('stream-array'); // only needed to turn array -> stream
our rows of data - maybe you loaded these from a CSV :-)
data = [
foo': 3, 'bar': 'hello'},
foo': 5, 'bar': 'bye'}
his is your JSON Table Schema - http://dataprotocols.org/json-table-schema/
schema = {
ields': [
{
'name': 'foo',
'type': 'integer'
},
{
'name': 'bar',
'type': 'string'
}
engine = new Sequelize('datastore', 'datastore', '', {
alect: 'sqlite',
orage: './example.db'
table = SchemaTable(engine, 'foo_table', schema);
e.create().then(function () {
ble.load_iter(streamify(data));
npm test