dropbox / dropbox/PyHive

AttributeError: __enter__ for presto.Connection and presto.connect

Open
#365 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.7k
Forks
545
PR merge metrics
No merged PRs in 30d

Description

```
Python 3.7.7
PyHive 0.6.1
Hive 3.1.2
Presto 0.237
```
When connecting to Presto with `pyhive.presto` and the context manager with:

```python
from pyhive import presto

with presto.Connection(host='localhost', port=8080, database='default') as connection:
cursor = connection.cursor()
cursor.execute("SHOW TABLES")
print(cursor.fetchall())
```

I get the following error suggesting that the context manager could not enter:

```
AttributeError: __enter__
```

But with `pyhive.hive` it works:

```python
from pyhive import hive

with hive.Connection(host='localhost', port=10000, database='default') as connection:
cursor = connection.cursor()
cursor.execute("SHOW TABLES")
print(cursor.fetchall())
```

I noticed the same two behaviors with `presto.connect` and `hive.connect` respectively.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.