Not compatible with PyHive in Python 3 due to dynamic modify TCLIService
See original GitHub issuePackage versions:
impyla==0.14.0
thrift==0.10.0
thrift-sasl==0.3.0
thriftpy==0.3.9
sasl==0.2.1
PyHive==0.5.0
Reproduce steps:
Python 3.6.3 (default, Oct 24 2017, 14:48:20)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import impala.dbapi
>>> import pyhive.hive
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/guyskk/ym/waimaietl/.venv/lib/python3.6/site-packages/pyhive/hive.py", line 11, in <module>
from TCLIService import constants
ImportError: cannot import name 'constants'
>>>
It was caused by https://github.com/cloudera/impyla/blob/master/impala/_thrift_api.py#L80,
# dynamically load the HS2 modules
ExecStats = load(os.path.join(thrift_dir, 'ExecStats.thrift'),
include_dirs=[thrift_dir])
TCLIService = load(os.path.join(thrift_dir, 'TCLIService.thrift'),
include_dirs=[thrift_dir])
ImpalaService = load(os.path.join(thrift_dir, 'ImpalaService.thrift'),
include_dirs=[thrift_dir])
sys.modules[ExecStats.__name__] = ExecStats
sys.modules[TCLIService.__name__] = TCLIService # <-----here!!!
sys.modules[ImpalaService.__name__] = ImpalaService
And PyHive also includes a TCLIService module, they conflict.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:11
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Python Pyhive module cannot import name hive - Stack Overflow
The file you're starting is named pyhive.py . When you do from pyhive import hive. inside your pyhive.py , then it will try...
Read more >PyHive - PyPI
PyHive is a collection of Python DB-API and SQLAlchemy interfaces for Presto and Hive. Usage. DB-API. from pyhive import presto # or import...
Read more >Solved: Re: pyhive connection error: thrift.transport.TTra...
pyhive connection error: thrift.transport. ... on a machine learning project, using pyhive since pyhs2 is not supported by python3.6.
Read more >[Example code]-Creating Table w PyHive & SqlAlchemy
I'm trying to create a table in a Hive Database using SqlAlchemy ORM. My setting is Python 3.6 with PyHive==0.6.1 and SQLAlchemy==1.2.11 (with...
Read more >pyhive insert multiple rows
Hive allows only appends, not inserts, into tables, so the INSERT keyword simply ... To update it, the generate.py file can be used:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@brentonmallen1 swap the import order.
Is there any method can solve this question