You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+32-9Lines changed: 32 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,8 @@ PyHive
14
14
======
15
15
16
16
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/>`_.
19
19
20
20
Usage
21
21
=====
@@ -25,7 +25,7 @@ DB-API
25
25
.. code-block:: python
26
26
27
27
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
29
29
cursor.execute('SELECT * FROM my_awesome_data LIMIT 10')
30
30
print cursor.fetchone()
31
31
print cursor.fetchall()
@@ -61,7 +61,7 @@ In Python 3.7 `async` became a keyword; you can use `async_` instead:
61
61
62
62
SQLAlchemy
63
63
----------
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``.
65
65
66
66
.. code-block:: python
67
67
@@ -117,7 +117,7 @@ Passing session configuration
117
117
'session_props': {'query_max_run_time': '1234m'}}
118
118
)
119
119
create_engine(
120
-
'trino://user@host:443/hive',
120
+
'trino+pyhive://user@host:443/hive',
121
121
connect_args={'protocol': 'https',
122
122
'session_props': {'query_max_run_time': '1234m'}}
123
123
)
@@ -136,15 +136,18 @@ Requirements
136
136
137
137
Install using
138
138
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
141
141
- ``pip install 'pyhive[trino]'`` for the Trino interface
142
142
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
+
143
146
PyHive works with
144
147
145
148
- 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>`_
148
151
- For Hive: `HiveServer2 <https://cwiki.apache.org/confluence/display/Hive/Setting+up+HiveServer2>`_ daemon
149
152
150
153
Changelog
@@ -162,6 +165,26 @@ Contributing
162
165
- We prefer having a small number of generic features over a large number of specialized, inflexible features.
163
166
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.
164
167
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>`_
0 commit comments