зеркало из https://github.com/mozilla/PyHive.git
Add readme
This commit is contained in:
Родитель
c96c09be99
Коммит
e4c75c9af8
|
@ -0,0 +1,32 @@
|
|||
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
|
||||
-----
|
||||
```python
|
||||
cursor = presto.connect('localhost').cursor()
|
||||
cursor.execute('SELECT * FROM user LIMIT 10')
|
||||
print cursor.fetchone()
|
||||
print cursor.fetchall()
|
||||
```
|
||||
|
||||
SQLAlchemy
|
||||
----------
|
||||
```python
|
||||
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: Thrift-generated `TCLIService` package
|
||||
- SQLAlchemy integration: `sqlalchemy` version 0.5.8
|
Загрузка…
Ссылка в новой задаче