Socket
Book a DemoInstallSign in
Socket

schema-to-sql

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

schema-to-sql

translate auto-schema object to table sql

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

schema-to-sql

Generate create table statements out of auto-schema objects, pretty specific to our needs and probably not useful to you ;D

Installation

$ npm install schema-to-sql

Example

var sql = require('schema-to-sql');

var schema = { action: 'varchar',
  version: 'float',
  timestamp: 'timestamp',
  channel: 'varchar',
  sessionId: 'varchar',
  userId: 'varchar',
  event: 'varchar',
  'properties.url': 'varchar',
  'properties.referrer': 'varchar',
  'properties.userAgent': 'varchar',
  'context.language': 'varchar',
  'context.library': 'varchar',
  'userAgent.family': 'varchar',
  'userAgent.major': 'varchar',
  'userAgent.minor': 'varchar',
  'userAgent.os': 'varchar',
  'userAgent.device': 'varchar',
  'userAgent.userAgent': 'varchar',
  'referrer.type': 'varchar',
  projectId: 'varchar' };

console.log(sql(schema));

yields:

create table users(
  action varchar(2048),
  version float,
  timestamp timestamp,
  channel varchar(2048),
  sessionId varchar(2048),
  userId varchar(2048),
  event varchar(2048),
  "properties.url" varchar(2048),
  "properties.referrer" varchar(2048),
  "properties.userAgent" varchar(2048),
  "context.language" varchar(2048),
  "context.library" varchar(2048),
  "userAgent.family" varchar(2048),
  "userAgent.major" varchar(2048),
  "userAgent.minor" varchar(2048),
  "userAgent.os" varchar(2048),
  "userAgent.device" varchar(2048),
  "userAgent.userAgent" varchar(2048),
  "referrer.type" varchar(2048),
  projectId varchar(2048));

License

MIT

Keywords

redshift

FAQs

Package last updated on 14 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts