HMSClient

0.1.1 · abandoned · verified Thu Apr 09

HMSClient is a Python package designed to interact with the Apache Hive Metastore via the Thrift protocol. It provides a thin Python wrapper around generated Thrift code to facilitate operations like checking for partitions. The current version is 0.1.1, but the project appears to be unmaintained, with its last release in April 2018.

Warnings

Install

Imports

Quickstart

Initialize the HMSClient and perform a basic operation, such as checking for a named partition. The host and port for the Metastore can be provided directly or configured via `HMS_HOST` and `HMS_PORT` environment variables.

import os
from hmsclient import hmsclient

host = os.environ.get('HMS_HOST', 'localhost')
port = int(os.environ.get('HMS_PORT', 9083))

# Example: Connect and check for a named partition
try:
    client = hmsclient.HMSClient(host=host, port=port)
    with client as c:
        # Replace 'your_db', 'your_table', and 'date=...' with actual values
        partition_exists = c.check_for_named_partition('your_db', 'your_table', 'date=20180101')
        print(f"Partition exists: {partition_exists}")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →