Skip to main content

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)

Download files

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

Source Distribution

json2hive-0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

json2hive-0.1-py2.py3-none-any.whl (6.3 kB view details)

Uploaded Python 2Python 3

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

Hashes for json2hive-0.1.tar.gz
Algorithm Hash digest
SHA256 7bc07f9815fcc7f6c2b49a39bc174b0b99800991407bc48d2703d2b50e55d944
MD5 4678901ab0b91e636619b35e2dac715d
BLAKE2b-256 85b8b8364f46a0f57053c6da41ce115a433eea4713877bcbcf4bb38469a21e07

See more details on using hashes here.

File details

Details for the file json2hive-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for json2hive-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 abc15703215a21cd2b0cda15735506b8f28bbc26d558bee1458690c10ab8af37
MD5 201320f94da78804cc4aecfe38da5421
BLAKE2b-256 56db18edae4a92dc5a91ec00494ffaa2cceac130f39d486491a91deaee3eeec0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page