0.1.4 • Published 5 years ago

@trinity-insight/generate-bigquery-schema v0.1.4

Weekly downloads
39
License
MIT
Repository
github
Last release
5 years ago

generate-bigquery-schema

FOSSA Status

Generate a BigQuery schema from an object or array of objects

Uses generate-schema to create individual schemas. This package serves as a wrapper around generate-schema for extensibility and our specific use cases.

Install

npm install @trinity-insight/generate-bigquery-schema

Usage

Single Object

const gbs = require('generate-bigquery-schema')

const singleObject = {
  stringKey: "string",
  numberKey: 88,
  objectKey: {
    cool: "we can nest things"
  }
}
console.log(gbs.generateSchema(singleObject))
// { fields:
//    [ { name: 'stringKey', type: 'STRING', mode: 'NULLABLE' },
//      { name: 'numberKey', type: 'INTEGER', mode: 'NULLABLE' },
//      { name: 'objectKey',
//        type: 'RECORD',
//        mode: 'NULLABLE',
//        fields: [Array] } ] }

Object Array

const multipleObjects = [
  {
    foo: 'bar',
    number: '4'
  },
  {
    foo: 'bar',
    number: 4
  }
]

console.log(gbs.generateSchema(multipleObjects))
// { fields:
//    [ { type: 'STRING',
//        mode: 'NULLABLE',
//        description: null,
//        name: 'foo' },
//      { type: 'INTEGER',
//        mode: 'NULLABLE',
//        description: null,
//        name: 'number' } ] }

Development

Installing

  1. git clone https://github.com/trinity-insight/generate-bigquery-schema.git
  2. npm install

Building to JS

  1. npm run build

Linting (StandardJS)

  1. npm run lint

Testing (Mocha)

  1. npm test

License

FOSSA Status

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.7-beta.0

5 years ago

0.0.7

5 years ago

0.0.65-beta.11

5 years ago

0.0.65-beta.10

5 years ago

0.0.65-beta.9

5 years ago

0.0.65-beta.8

5 years ago

0.0.65-beta.7

5 years ago

0.0.65-beta.6

5 years ago

0.0.65-beta.5

5 years ago

0.0.65-beta.4

5 years ago

0.0.65-beta.3

5 years ago

0.0.65-beta.2

5 years ago

0.0.65-beta.1

5 years ago

0.0.65-beta.0

5 years ago

0.0.65

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago