Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/segment-boneyard/auto-schema

Generate Redshift schemas from sample objects
https://github.com/segment-boneyard/auto-schema

Last synced: about 5 hours ago
JSON representation

Generate Redshift schemas from sample objects

Awesome Lists containing this project

README

        

# auto-schema

Generate Redshift schemas from sample objects.

## Installation

```
$ npm install auto-schema
```

## Example

```js
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:

```js
{ '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