Skip to content

Commit d4ae481

Browse files
authored
update readme to reflect recent changes (#459)
1 parent 5f0ee1f commit d4ae481

1 file changed

Lines changed: 32 additions & 9 deletions

File tree

README.rst

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ PyHive
1414
======
1515

1616
PyHive is a collection of Python `DB-API <http://www.python.org/dev/peps/pep-0249/>`_ and
17-
`SQLAlchemy <http://www.sqlalchemy.org/>`_ interfaces for `Presto <http://prestodb.io/>`_ and
18-
`Hive <http://hive.apache.org/>`_.
17+
`SQLAlchemy <http://www.sqlalchemy.org/>`_ interfaces for `Presto <http://prestodb.io/>`_ ,
18+
`Hive <http://hive.apache.org/>`_ and `Trino <https://trino.io/>`_.
1919

2020
Usage
2121
=====
@@ -25,7 +25,7 @@ DB-API
2525
.. code-block:: python
2626
2727
from pyhive import presto # or import hive or import trino
28-
cursor = presto.connect('localhost').cursor()
28+
cursor = presto.connect('localhost').cursor() # or use hive.connect or use trino.connect
2929
cursor.execute('SELECT * FROM my_awesome_data LIMIT 10')
3030
print cursor.fetchone()
3131
print cursor.fetchall()
@@ -61,7 +61,7 @@ In Python 3.7 `async` became a keyword; you can use `async_` instead:
6161
6262
SQLAlchemy
6363
----------
64-
First install this package to register it with SQLAlchemy (see ``setup.py``).
64+
First install this package to register it with SQLAlchemy, see ``entry_points`` in ``setup.py``.
6565

6666
.. code-block:: python
6767
@@ -117,7 +117,7 @@ Passing session configuration
117117
'session_props': {'query_max_run_time': '1234m'}}
118118
)
119119
create_engine(
120-
'trino://user@host:443/hive',
120+
'trino+pyhive://user@host:443/hive',
121121
connect_args={'protocol': 'https',
122122
'session_props': {'query_max_run_time': '1234m'}}
123123
)
@@ -136,15 +136,18 @@ Requirements
136136

137137
Install using
138138

139-
- ``pip install 'pyhive[hive]'`` for the Hive interface and
140-
- ``pip install 'pyhive[presto]'`` for the Presto interface.
139+
- ``pip install 'pyhive[hive]'`` or ``pip install 'pyhive[hive_pure_sasl]'`` for the Hive interface
140+
- ``pip install 'pyhive[presto]'`` for the Presto interface
141141
- ``pip install 'pyhive[trino]'`` for the Trino interface
142142

143+
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>`_.
144+
Hence PyHive also supports `pure-sasl <https://pypi.org/project/pure-sasl/>`_ via additional extras ``'pyhive[hive_pure_sasl]'`` which support Python 3.11.
145+
143146
PyHive works with
144147

145148
- Python 2.7 / Python 3
146-
- For Presto: Presto install
147-
- For Trino: Trino install
149+
- For Presto: `Presto installation <https://prestodb.io/docs/current/installation.html>`_
150+
- For Trino: `Trino installation <https://trino.io/docs/current/installation.html>`_
148151
- For Hive: `HiveServer2 <https://cwiki.apache.org/confluence/display/Hive/Setting+up+HiveServer2>`_ daemon
149152

150153
Changelog
@@ -162,6 +165,26 @@ Contributing
162165
- We prefer having a small number of generic features over a large number of specialized, inflexible features.
163166
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.
164167

168+
Tips for test environment setup
169+
================================
170+
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.
171+
It may not be feasible for everyone to get those credentials. Hence below are alternative instructions to setup test environment.
172+
173+
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.
174+
You can add below lines to its docker-compose.yaml to start Trino in same environment::
175+
176+
trino:
177+
image: trinodb/trino:351
178+
ports:
179+
- "18080:18080"
180+
volumes:
181+
- ./trino:/etc/trino
182+
183+
Note: ``./trino`` for docker volume defined above is `trino config from PyHive repository <https://github.com/dropbox/PyHive/tree/master/scripts/travis-conf/trino>`_
184+
185+
Then run::
186+
docker-compose up -d
187+
165188
Testing
166189
=======
167190
.. image:: https://travis-ci.org/dropbox/PyHive.svg

0 commit comments

Comments
 (0)