Registry / database / hmsclient

hmsclient

JSON →
library0.1.1pypypi✓ verified 31d ago

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.

pip install hmsclient
INSTALL
IMPORT
SIG · HMSCLIENT
H
hmsclient
databasepythonv0.1.1
Install
2.5s avg
Import
283ms
Disk
24MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.284s · 27MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.5s · import 0.282s · 24MB
24MB installed
● package 24MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

hmsclient
✓ from hmsclient import hmsclient
HMSClient
✓ from hmsclient import hmsclient client = hmsclient.HMSClient(...)

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}")
Debug
Known issues
breakingThe `hmsclient` library has not been updated since April 2018, and its GitHub repository shows no recent activity for eight years. This makes it highly likely to be incompatible with newer Python versions (e.g., Python 3.8+) or recent Apache Hive Metastore versions without significant issues or manual patches.
fix
Consider using `hmsclient-hive-3` (if targeting Hive Metastore API v3.0) or an alternative, actively maintained Hive Metastore client library. If sticking with `hmsclient`, thorough compatibility testing with your Python and Hive versions is crucial.
affects: <=0.1.1
gotchaThis library is primarily designed for unsecured Thrift connections. Using it in environments requiring Kerberos or other secure authentication mechanisms for the Hive Metastore is not directly supported and may expose security vulnerabilities.
fix
Avoid using this client in production environments requiring secure Metastore connections. Explore alternative clients that explicitly support Kerberos or other secure authentication methods.
affects: All
gotchaThe client lacks built-in automatic reconnection logic. If the Hive Metastore becomes temporarily unstable or the connection drops, the client will not automatically attempt to re-establish the connection, leading to persistent failures in your application until manually restarted. This is a common challenge with HMS clients.
fix
Implement custom retry and reconnection logic in your application code when using `hmsclient` to handle transient Metastore connectivity issues gracefully.
affects: All
deprecatedThe existence of `hmsclient-hive-3` (a fork explicitly rebuilt for Hive Metastore API version 3.0) strongly suggests that the original `hmsclient` (version 0.1.1) may not be compatible with Hive Metastore versions 3.0 and newer.
fix
If working with Hive Metastore 3.0 or later, consider migrating to `hmsclient-hive-3` or another client specifically designed for newer Hive versions. Test thoroughly against your target Metastore version.
affects: <=0.1.1 when used with Hive Metastore >=3.0
Errors
Common errors & fixes
thrift.transport.TTransport.TTransportException: b'Error in sasl_decode (-1) SASL(-1): generic failure: Unable to find a callback: 32775'
This error indicates a problem during the SASL (Simple Authentication and Security Layer) handshake, often due to misconfiguration of Kerberos or other authentication mechanisms, or an incompatibility between the Thrift library version and the Hive Metastore server's configuration.
fix
Ensure Kerberos configuration (keytab, krb5.conf, service principal name) is correct on the client, that the `thrift_sasl` package is installed, and that the client's Thrift version is compatible with the Metastore server. Consider testing without SASL if possible to isolate the issue, or regenerating Thrift code with a compatible Thrift compiler version if a newer Metastore version is used.
org.apache.hadoop.hive.metastore.api.NoSuchObjectException: db.table table not found
This error means that the specific database, table, or other Hive Metastore object you are trying to access (e.g., `db.table`) does not exist in the Hive Metastore.
fix
Verify that the database and table names are spelled correctly and exist in the Hive Metastore. You can use a Hive client (like `beeline`) to confirm the existence of the object.
ModuleNotFoundError: No module named 'hmsclient'
The `hmsclient` package is not installed or not accessible in your current Python environment.
fix
Install the package using pip: `pip install hmsclient`. If using Python 3, consider installing `hmsclient-hive-3` (`pip install hmsclient-hive-3`) as the original `hmsclient` might have compatibility issues or be unmaintained for newer Python versions.
AttributeError: module 'hmsclient' has no attribute 'HMSClient'
While the `hmsclient` module might be imported, the `HMSClient` class is not found directly within it, possibly due to incorrect import syntax, a corrupted installation, or a significant change in the library's internal structure or exposure of its main class.
fix
Ensure you are using the correct import statement as shown in the library's documentation: `from hmsclient import hmsclient`. The class is then accessed as `hmsclient.HMSClient()`. If the issue persists, reinstall the package and confirm compatibility with your Python version.
Upgrade
Version history
0.1.1latest on PyPI · released Apr 24, 2018
Audit
Dependencies
apache-thriftrequiredProvides the underlying Thrift protocol implementation for communication with the Hive Metastore.
Agent activity
12 hits · last 30 days
node
12
Resources