PyHive
Python interface to Hive
What it is and what it does
PyHive is a Python client library that bridges your code to Hive, Presto, and Trino clusters via two interfaces: a standard DB-API (similar to psycopg2 or sqlite3) and a dialect for query builders. It lets you execute SQL queries against these big-data engines and fetch results, with optional asynchronous execution for long-running queries on Hive. The package has no runtime dependencies by default; you install extras for the specific engine you need (hive, presto, or trino), each bringing its own transport and protocol dependencies.
The library is minimal in scope—it handles connection, query execution, and result fetching without attempting to abstract away engine-specific features. It supports session configuration (query timeouts, resource limits), authentication (LDAP, basic auth over HTTPS), and both modern and legacy patterns. The project is maintained but explicitly marked unsupported in its description, and installation friction is high due to the need to select and install the correct extras for your target engine.
Use it for:
- Execute ad-hoc SQL queries against a Hive cluster from a Python script or notebook.
- Build a data pipeline that reads from Presto or Trino and processes results in Python.
- Construct dynamic queries against Hive with LDAP authentication via the dialect interface.
- Poll asynchronous Hive queries for completion and fetch logs while waiting.
- Integrate Hive or Trino as a data source in a Python application via the DB-API.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyHive provides DB-API and SQLAlchemy interfaces to query Presto, Hive, and Trino clusters from Python, supporting both synchronous and asynchronous execution.
Yes, if you need to query Hive, Presto, or Trino from Python and are willing to manage the extra selection and engine-specific dependencies. The package is actively maintained, permissively licensed, and widely downloaded, but install friction is high and the project's own description marks it unsupported—clarify your engine's support status before committing. No known vulnerabilities.
Install
pyhive on PyPI
pip
pip install pyhiveuv
uv add pyhivepoetry
poetry add pyhiveInstalling PyHive
Before you install
Installation requires choosing extras for your target engine (hive, presto, or trino); the hive extra uses sasl which does not support Python 3.11, though a pure-sasl alternative is available. The package is actively maintained but marked unsupported in its description.
License in practice
Licensed under Apache License, Version 2.0 (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
# DB-API usage
from pyhive import presto
cursor = presto.connect('localhost').cursor()
cursor.execute('SELECT * FROM my_table LIMIT 10')
print(cursor.fetchall())
# Alternative engines
from pyhive import hive
from pyhive import trino
Requires a running Hive, Presto, or Trino server accessible at the specified host and port; install with extras (pip install 'pyhive[presto]', 'pyhive[hive]', or 'pyhive[trino]').
Verify before relying
- Current maintenance status unclear despite 'active' label and 'unsupported' notice in description—clarify project's actual support level.
- Python 3.11 compatibility with hive extra depends on sasl package status; pure-sasl alternative availability should be verified.
- Query generation functionality noted as not exhaustive in documentation; scope of supported SQL operations unclear.
Package facts
| License | Apache License, Version 2.0 (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | actively maintained — 1,093 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,915,720/month — #1,812 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: PyHive-0.7.0.tar.gz
Tags
More Front-Ends packages
SQLAlchemy is a Python SQL toolkit and Object…
permissive · top 100 on PyPI
psycopg2-binarypsycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
alembicAlembic generates and manages database schema…
permissive · top 1,000 on PyPI
weaviate-clientA Python client library for connecting to and…
permissive · top 1,000 on PyPI
databricks-sql-connectorA Python client library that connects to…
permissive · top 1,000 on PyPI
psycopgPsycopg 3 is a PostgreSQL database adapter for…
copyleft · top 1,000 on PyPI
databricks-dbapiProvides a DBAPI 2.0 connection interface and…
permissive · top 15,000 on PyPI
qds-sdkA Python SDK for authenticating with and…
permissive · top 15,000 on PyPI
pyhiveapiA Python library for controlling Hive smart…
permissive · top 15,000 on PyPI
trinoPython client library for Trino, a distributed…
permissive · top 1,000 on PyPI
pure-transportProvides a Thrift transport for PyHive…
permissive · top 15,000 on PyPI
impylaimpyla is a Python DB API 2.0-compliant client…
permissive · top 5,000 on PyPI
pinotdbProvides Python DB-API and SQLAlchemy dialect…
permissive · top 1,000 on PyPI
sqlalchemy-trinoProvides a SQLAlchemy dialect for connecting to…
permissive · top 15,000 on PyPI
pydorisPydoris is a Python client for Apache Doris…
permissive · top 15,000 on PyPI
pydoris-customA Python client for Apache Doris that provides…
permissive · top 15,000 on PyPI