auto-schema

0.3.2 • Public • Published

auto-schema

Generate Redshift schemas from sample objects.

Installation

$ npm install auto-schema

Example

var autoschema = require('auto-schema');
 
var schema = autoschema({
  user: {
    id: 123242123,
 
    name: {
      first: 'tobi',
      last: 'loki'
    },
 
    properties: {
      category: 'Buttons',
      label: 'Login'
    },
 
    context: {
      userAgent: 'Mozilla whatever'
    }
  }
});
 
console.log(schema);

yields:

{ 'user.id': 'float',
  'user.name.first': 'varchar(2048)',
  'user.name.last': 'varchar(2048)',
  'user.properties.category': 'varchar(2048)',
  'user.properties.label': 'varchar(2048)',
  'user.context.userAgent': 'varchar(2048)' }

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i auto-schema

Weekly Downloads

1

Version

0.3.2

License

MIT

Last publish

Collaborators

  • tjholowaychuk