skillfed

PyHive

Python interface to Hive

pyhive v0.7.0 6.9M downloads/30d#1,812 on PyPI1,694
Permissive license Apache License, Version 2.0 Active released

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 pyhive

uv

uv add pyhive

poetry

poetry add pyhive

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentTopic :: Database :: Front-Ends

Tags

hive query client pythonpresto python interfacetrino python driverdb-api hive connectionhive dialect pythonasync hive queriesbig data sql python
big-data-sqldb-apihive-client

More Front-Ends packages