json2hive is a command line utility that can automatically generate CREATE TABLE statements for Hive tables backed by JSON data.
Features
Automatically infer schema of JSON data by analysing JSON records
Supports external and managed Hive tables
Can be used as command line utility or programmatically
Installation
You can install json2hive using pip:
$ pip install json2hive
It is strongly recommended that you install json2hive inside a virtual environment!
Usage
On the Command Line
Run the following and follow the instructions:
$ json2hive --help
As a library
from json2hive.utils import infer_schema
from json2hive.generators import generate_json_table_statement
# infer schema from objects, these objects could be the result of json.loads(...)
object1 = {'name': 'John', age: 25}
object2 = {'name': 'Mary', age: 23}
schema = infer_schema([object1, object2])
# Generate CREATE TABLE statement
statement = generate_json_table_statement('example', schema, managed=True)
print(statement)
Metadata
Release files for json2hive 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| json2hive-0.1.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| json2hive-0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 10.5 kB
Release files / json2hive-0.1.tar.gz
| Download URL | json2hive-0.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7bc07f9815fcc7f6c2b49a39bc174b0b99800991407bc48d2703d2b50e55d944
|
|
BLAKE2b-256 checksum How to use checksums |
85b8b8364f46a0f57053c6da41ce115a433eea4713877bcbcf4bb38469a21e07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / json2hive-0.1-py2.py3-none-any.whl
| Download URL | json2hive-0.1-py2.py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
abc15703215a21cd2b0cda15735506b8f28bbc26d558bee1458690c10ab8af37
|
|
BLAKE2b-256 checksum How to use checksums |
56db18edae4a92dc5a91ec00494ffaa2cceac130f39d486491a91deaee3eeec0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |