INACTIVE - http://mzl.la/ghe-archive - Python interface to Hive and Presto. 🐝
ΠŸΠ΅Ρ€Π΅ΠΉΡ‚ΠΈ ΠΊ Ρ„Π°ΠΉΠ»Ρƒ
Jing Wang e49f70fe93 Add Hive backend, refactor common code, fix bugs 2014-02-03 00:21:02 -08:00
pyhive Add Hive backend, refactor common code, fix bugs 2014-02-03 00:21:02 -08:00
scripts Add Hive backend, refactor common code, fix bugs 2014-02-03 00:21:02 -08:00
.gitignore Add Eclipse files to gitignore 2014-02-02 18:27:26 -08:00
README.md Add Hive backend, refactor common code, fix bugs 2014-02-03 00:21:02 -08:00

README.md

PyHive

PyHive is a python is a collection of DBAPI and SQLAlchemy wrappers for Presto's REST interface and HiveServer2's Thrift interface.

Usage

DBAPI

cursor = presto.connect('localhost').cursor()
cursor.execute('SELECT * FROM user LIMIT 10')
print cursor.fetchone()
print cursor.fetchall()

SQLAlchemy

engine = create_engine('presto://localhost:8080/hive?schema=default')
metadata = MetaData(bind=engine)
user = Table('user', metadata, autoload=True)
print select([func.count('*')], from_obj=user).scalar()

Requirements

  • Presto DBAPI: Just a Presto install
  • Hive DBAPI: HiveServer2 daemon, TCLIService, thrift, sasl, thrift_sasl
  • SQLAlchemy integration: sqlalchemy version 0.5