Convert JSON schema to Google BigQuery schema
This includes the ability to:
- Create tables
- 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.
npm install jsonschema-bigquery
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.
{
preventAdditionalObjectProperties: true
}
preventAdditionalObjectProperties
- boolean, check for additional object properties in schemas.
npm test