Indexed by TopGit from live GitHub metadata: dropbox/PyHive has 1.7k stars, written primarily in Python. Python interface to Hive and Presto. 🐝
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
========================================================
PyHive project has been donated to Apache Kyuubi
You can follow it's development and report any issues you are experiencing here: https://github.com/apache/kyuubi/tree/master/python/pyhive
Legacy notes / instructions
PyHive
PyHive is a collection of Python DB-API <http://www.python.org/dev/peps/pep-0249/>_ and
SQLAlchemy <http://www.sqlalchemy.org/>_ interfaces for Presto <http://prestodb.io/>_ ,
Hive <http://hive.apache.org/>_ and Trino <https://trino.io/>_.
Usage
DB-API
.. code-block:: python
from pyhive import presto # or import hive or import trino
cursor = presto.connect('localhost').cursor() # or use hive.connect or use trino.connect
cursor.execute('SELECT * FROM my_awesome_data LIMIT 10')
print cursor.fetchone()
print cursor.fetchall()
DB-API (asynchronous)
.. code-block:: python
from pyhive import hive
from TCLIService.ttypes import TOperationState
cursor = hive.connect('localhost').cursor()
cursor.execute('SELECT * FROM my_awesome_data LIMIT 10', async=True)
status = cursor.poll().operationState
while status in (TOperationState.INITIALIZED_STATE, TOperationState.RUNNING_STATE):
logs = cursor.fetch_logs()
for message in logs:
print message
# If needed, an asynchronous query can be cancelled at any time with:
# cursor.cancel()
status = cursor.poll().operationState
print cursor.fetchall()
In Python 3.7 async became a keyword; you can use async_ instead:
.. code-block:: python
cursor.execute('SELECT * FROM my_awesome_data LIMIT 10', async_=True)
SQLAlchemy
First install this package to register it with SQLAlchemy, see entry_points in setup.py.
pip install 'pyhive[hive]' or pip install 'pyhive[hive_pure_sasl]' for the Hive interface
pip install 'pyhive[presto]' for the Presto interface
pip install 'pyhive[trino]' for the Trino interface
Note: 'pyhive[hive]' extras uses sasl <https://pypi.org/project/sasl/>_ that doesn't support Python 3.11, See github issue <https://github.com/cloudera/python-sasl/issues/30>.
Hence PyHive also supports pure-sasl <https://pypi.org/project/pure-sasl/> via additional extras 'pyhive[hive_pure_sasl]' which support Python 3.11.
PyHive works with
Python 2.7 / Python 3
For Presto: Presto installation <https://prestodb.io/docs/current/installation.html>_
For Trino: Trino installation <https://trino.io/docs/current/installation.html>_
For Hive: HiveServer2 <https://cwiki.apache.org/confluence/display/Hive/Setting+up+HiveServer2>_ daemon
Changelog
See https://github.com/dropbox/PyHive/releases.
Contributing
Please fill out the Dropbox Contributor License Agreement at https://opensource.dropbox.com/cla/ and note this in your pull request.
Changes must come with tests, with the exception of trivial things like fixing comments. See .travis.yml for the test environment setup.
Notes on project scope:
This project is intended to be a minimal Hive/Presto client that does that one thing and nothing else.
Features that can be implemented on top of PyHive, such integration with your favorite data analysis library, are likely out of scope.
We prefer having a small number of generic features over a large number of specialized, inflexible features.
For example, the Presto code takes an arbitrary requests_session argument for customizing HTTP calls, as opposed to having a separate parameter/branch for each requests option.
Tips for test environment setup
You can setup test environment by following .travis.yaml in this repository. It uses Cloudera's CDH 5 <https://docs.cloudera.com/documentation/enterprise/release-notes/topics/cdh_vd_cdh_download_510.html>_ which requires username and password for download.
It may not be feasible for everyone to get those credentials. Hence below are alternative instructions to setup test environment.
You can clone this repository <https://github.com/big-data-europe/docker-hive/blob/master/docker-compose.yml>_ which has Docker Compose setup for Presto and Hive.
You can add below lines to its docker-compose.yaml to start Trino in same environment::
Note: ./trino for docker volume defined above is trino config from PyHive repository <https://github.com/dropbox/PyHive/tree/master/scripts/travis-conf/trino>_
WARNING: This drops/creates tables named one_row, one_row_complex, and many_rows, plus a
database called pyhive_test_database.
Updating TCLIService
The TCLIService module is autogenerated using a TCLIService.thrift file. To update it, the
generate.py file can be used: python generate.py <TCLIServiceURL>. When left blank, the
version for Hive 2.3 will be downloaded.
The most recent commit recorded on dropbox/PyHive was 7 months ago, based on the GitHub push timestamp. The repository has 543 forks — one of the better signals of community interest.
How does dropbox/PyHive compare to other Backend projects?
dropbox/PyHive is tracked by TopGit in the Backend category, with 1.7k GitHub stars and written in Python. Browse the Backend topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does dropbox/PyHive have?
dropbox/PyHive has 1.7k GitHub stars — refresh the page for the live number, or check github.com/dropbox/PyHive. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What is dropbox/PyHive?
dropbox/PyHive (dropbox/PyHive) is a Python project on GitHub. From the project's own README: Python interface to Hive and Presto. 🐝
What language is dropbox/PyHive written in?
dropbox/PyHive is written primarily in Python. GitHub's language field is based on the largest share of bytes in the default branch.
What topics is dropbox/PyHive associated with?
GitHub's repository topics for dropbox/PyHive: "dbapi", "hive", "hiveserver2", "presto", "python", "sqlalchemy". TopGit's editorial category is Backend.
Why is dropbox/PyHive categorized under Backend?
TopGit places dropbox/PyHive in the Backend category based on its GitHub topics and description (tagged: "dbapi", "hive", "hiveserver2"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.
Curious whether PyHive is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about PyHive.