Socket
Socket
Sign inDemoInstall

bigquery-schema-generator

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

bigquery-schema-generator


Version published
Weekly downloads
256
increased by19.07%
Maintainers
1
Install size
3.22 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 14 May 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc