Là một dự án backend, dropbox/PyHive đã đạt 1.7k sao trên GitHub, ngôn ngữ Python. Python interface to Hive and Presto. 🐝
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
========================================================
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.
dropbox/PyHive có 1.7k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/dropbox/PyHive. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
dropbox/PyHive có những chủ đề gì?
GitHub topics của dropbox/PyHive: "dbapi", "hive", "hiveserver2", "presto", "python", "sqlalchemy". TopGit xếp repo vào nhóm Backend.
dropbox/PyHive còn đang phát triển không?
Commit gần nhất trên dropbox/PyHive là 7 tháng trước (theo timestamp GitHub). Repo có 543 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
dropbox/PyHive là gì?
dropbox/PyHive (dropbox/PyHive) là dự án Python trên GitHub. Theo mô tả gốc: Python interface to Hive and Presto. 🐝
dropbox/PyHive so với các dự án Backend khác thế nào?
dropbox/PyHive được TopGit xếp vào nhóm Backend, với 1.7k sao GitHub và viết bằng Python. Xem trang chủ đề Backend trên TopGit để so sánh với các dự án tương tự theo số sao và mức độ hoạt động.
dropbox/PyHive viết bằng ngôn ngữ gì?
dropbox/PyHive chủ yếu viết bằng Python. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Vì sao dropbox/PyHive được xếp vào nhóm Backend?
TopGit xếp dropbox/PyHive vào nhóm Backend dựa trên GitHub topics và mô tả của repo (gắn thẻ: "dbapi", "hive", "hiveserver2"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
Đọc đầy đủ README ở tab phía trên.
Chưa chắc PyHive có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về PyHive.