Skip to content

nw/bigquery-schema-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Bigquery Schema Generator

Generate schema for Google bigquery by inspecting data to conform with data types. Currently, the BYTES type is not supported.

Installation

npm i -D bigquery-schema-generator

Usage

var generator = require('bigquery-schema-generator')
var schema = generator(data)

The required mode is currently not supported. Everything will result in NULLABLE or REPEATED if an array is detected.

Example

var generator = require('bigquery-schema-generator')
var pkg = require('./package.json')
var schema = generator(pkg)

The schema will look like:

[
  {
    "name": "name",
    "type": "STRING",
    "mode": "NULLABLE"
  },
  {
    "name": "version",
    "type": "STRING",
    "mode": "NULLABLE"
  },
  {
    "name": "main",
    "type": "STRING",
    "mode": "NULLABLE"
  },
  {
    "name": "repository",
    "type": "RECORD",
    "mode": "NULLABLE",
    "fields": [
      {
        "name": "type",
        "type": "STRING",
        "mode": "NULLABLE"
      },
      {
        "name": "url",
        "type": "STRING",
        "mode": "NULLABLE"
      }
    ]
  },
  {
    "name": "bugs",
    "type": "RECORD",
    "mode": "NULLABLE",
    "fields": [
      {
        "name": "url",
        "type": "STRING",
        "mode": "NULLABLE"
      }
    ]
  },
  {
    "name": "homepage",
    "type": "STRING",
    "mode": "NULLABLE"
  },
  {
    "name": "keywords",
    "type": "STRING",
    "mode": "REPEATED"
  },
  {
    "name": "author",
    "type": "STRING",
    "mode": "NULLABLE"
  },
  {
    "name": "license",
    "type": "STRING",
    "mode": "NULLABLE"
  }
]

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published