Skip to content

holidayextras/jsonschema-bigquery

 
 

Repository files navigation

jsonschema-bigquery

npm Build Status

Convert JSON schema to Google BigQuery schema

This includes the ability to:

  1. Create tables
  2. Patch tables

Further enhancements are planned: delete tables (dev only), create dataset, set data ACLs

Note that some features involve bespoke interpretation of schema details suited to our environment.

Install

npm install jsonschema-bigquery

Consume

jsbq -p <gbq project> -d <gbq dataset> -j <json schema file> --preventAdditionalObjectProperties

For embedded usage the following will allow and support runtime schema conversion and table maintenance:

const jsonSchemaBigquery = require('jsonschema-bigquery')
const bigquerySchema = jsonSchemaBigquery.run(jsonSchemaObject, options)

Please ensure that the input JSON schema is dereferenced so that all external references have been resolved. json-schema-ref-parser can do this, prior to using this module.

Options

{
  preventAdditionalObjectProperties: true
}
  • preventAdditionalObjectProperties - boolean, check for additional object properties in schemas.

Test

npm test

About

Convert JSON schema to Google BigQuery schema

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 94.3%
  • Shell 5.7%