Jsonschema to Glue struct
A small library that works to read your provided jsonschema and convert it to a glue struct model, in this way you can integrate it in your pipeline or uses it just to get a output and insert manually in your glue table schema.
Installation
pip install glue-struct-transform
Get Started
How to convert a full json schema to a glue struct schema using this lib
import json
from glue_struct_transform import GlueStructTransform
# Read or set your json schema
schema = open(f'YOUR_JSON_SCHEMA.json',)
schemaLoad = json.load(schema)
# Pass your json schema in dict type to the function
result = GlueStructTransform.json_schema_to_glue_struct(schemaLoad)
How to convert a object into the json schema to a glue struct schema using this lib
import json
from glue_struct_transform import GlueStructTransform
# Read or set your json schema
schema = open(f'YOUR_JSON_SCHEMA.json',)
schemaLoad = json.load(schema)
# Pass your json schema in dict type to the function
result = GlueStructTransform.json_schema_to_glue_struct(schemaLoad, objectField = "objectKey", fullSchema = False)
How to convert a full json to a glue struct schema using this lib
import json
from glue_struct_transform import GlueStructTransform
# Read or set your json schema
payload = open(f'YOUR_JSON_FILE.json',)
payloadLoad = json.load(payload)
# Pass your json schema in dict type to the function
result = GlueStructTransform.json_schema_to_glue_struct(payloadLoad)
How to convert a object into the json file to a glue struct schema using this lib
import json
from glue_struct_transform import GlueStructTransform
# Read or set your json schema
payload = open(f'YOUR_JSON_FILE.json',)
payloadLoad = json.load(payload)
# Pass your json schema in dict type to the function
result = GlueStructTransform.json_schema_to_glue_struct(payloadLoad, objectField = "objectKey", fullBody = False)
Conversions implementation status
| From | From Type | Glue Schema type | Implementation status | Version |
|---|---|---|---|---|
| Json Schema | string | string | implemented |
0.1.0 |
| Json Schema | number | double | implemented |
0.1.0 |
| Json Schema | integer | int | implemented |
0.1.0 |
| Json Schema | object | struct | implemented |
0.1.0 |
| Json Schema | array | array | implemented |
0.1.0 |
| Json Schema | boolean | boolean | implemented |
0.1.0 |
| Json Schema | null | Raises exception | implemented |
0.1.2 |
| Json | str | string | implemented |
0.3.0 |
| Json | float | double | implemented |
0.3.0 |
| Json | int | int | implemented |
0.3.0 |
| Json | dict | struct | implemented |
0.3.0 |
| Json | list | array | implemented |
0.3.0 |
| Json | null | Raises exception | implemented |
0.3.0 |
Metadata
Release files for glue-struct-transform 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| glue-struct-transform-0.4.0.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| glue_struct_transform-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / glue-struct-transform-0.4.0.tar.gz
| Download URL | glue-struct-transform-0.4.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8b3e459f3a4b743b285393d277925f1b6b2ffa9be4708ded13d441a6177b01f
|
|
BLAKE2b-256 checksum How to use checksums |
acfbc2c640fe1a241945e90a7c226156155b89e7296c3bef3878ecc600559034
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4
|
Release files / glue_struct_transform-0.4.0-py3-none-any.whl
| Download URL | glue_struct_transform-0.4.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ae6a9661db97553bb5a96b44c32568b5dedd832ad9f37f292213cce4be5a7b3
|
|
BLAKE2b-256 checksum How to use checksums |
8b3ffbf0aa2afc7d14feb33fd6d914751d41a5a96c2ac8886f4afa25e5ed9410
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4
|