This libs works to convert a json schema or json to a glue schema struct.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for glue-struct-transform-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66baaf4ab828cdb5cc660d4a1a675444ebdf3ab0c8807dc2ad14acdb618ee31e |
|
MD5 | 1d219a1c50133ffe869c2f3d4f9e46ea |
|
BLAKE2b-256 | 6e067895f4f8d125a8ee954629d7a7ab403b9997c506f30ba258ddac3f4af3d2 |
Hashes for glue_struct_transform-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc0cfc3636b5e834990efae8c276b5ec494e34cc242a51108b018f2b94f8abb7 |
|
MD5 | 9b2fabfd4a3666f58adef595e140696b |
|
BLAKE2b-256 | 897012fa865f1d05fe787d54d451aaaf2bf4ba99c8f910827c8ba49852bd5dcc |