Generate Hive CREATE TABLE statements from json data
Project description
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)
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
File details
Details for the file json2hive-0.1.tar.gz
.
File metadata
- Download URL: json2hive-0.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bc07f9815fcc7f6c2b49a39bc174b0b99800991407bc48d2703d2b50e55d944 |
|
MD5 | 4678901ab0b91e636619b35e2dac715d |
|
BLAKE2b-256 | 85b8b8364f46a0f57053c6da41ce115a433eea4713877bcbcf4bb38469a21e07 |
File details
Details for the file json2hive-0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: json2hive-0.1-py2.py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abc15703215a21cd2b0cda15735506b8f28bbc26d558bee1458690c10ab8af37 |
|
MD5 | 201320f94da78804cc4aecfe38da5421 |
|
BLAKE2b-256 | 56db18edae4a92dc5a91ec00494ffaa2cceac130f39d486491a91deaee3eeec0 |