Skip to main content

A tool to transpile JSON Schema into schemas for data processing

Project description

jsonschema-transpiler

A tool for transpiling JSON Schema into schemas for Avro and BigQuery.

Installation

pip install jst

Usage

import json
import jst


json_schema = {
    "items": {
        "properties": {
            "field_1": {"type": "string"},
            "field_2": {"type": "integer"},
        },
        "type": "object",
    },
    "type": "array",
}
bq_schema = json.loads(jst.convert_bq(json.dumps(json_schema)))

assert bq_schema == [
    {
        "fields": [
            {"mode": "NULLABLE", "name": "field_1", "type": "STRING"},
            {"mode": "NULLABLE", "name": "field_2", "type": "INT64"},
        ],
        "mode": "REPEATED",
        "name": "root",
        "type": "RECORD",
    }
]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jst-1.10.0.tar.gz (64.0 kB view hashes)

Uploaded Source

Built Distributions

jst-1.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (744.6 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

jst-1.10.0-cp39-none-win_amd64.whl (659.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

jst-1.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (744.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

jst-1.10.0-cp39-cp39-macosx_10_7_x86_64.whl (677.5 kB view hashes)

Uploaded CPython 3.9 macOS 10.7+ x86-64

jst-1.10.0-cp38-none-win_amd64.whl (659.8 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

jst-1.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (744.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

jst-1.10.0-cp38-cp38-macosx_10_7_x86_64.whl (677.5 kB view hashes)

Uploaded CPython 3.8 macOS 10.7+ x86-64

jst-1.10.0-cp37-none-win_amd64.whl (659.8 kB view hashes)

Uploaded CPython 3.7 Windows x86-64

jst-1.10.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (744.5 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

jst-1.10.0-cp37-cp37m-macosx_10_7_x86_64.whl (677.6 kB view hashes)

Uploaded CPython 3.7m macOS 10.7+ x86-64

jst-1.10.0-cp36-none-win_amd64.whl (659.7 kB view hashes)

Uploaded CPython 3.6 Windows x86-64

jst-1.10.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (744.2 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

jst-1.10.0-cp36-cp36m-macosx_10_7_x86_64.whl (677.1 kB view hashes)

Uploaded CPython 3.6m macOS 10.7+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page