andrew
andrew

Reputation: 19

Use python 3 to connect to hive

i am trying to access hive using python 3.7 i am using pyhive to do it when i try to use pyhive in python 3.7 i am getting the following error from pyhive import hive

Traceback (most recent call last):
  File "code_sample.py", line 2, in <module>
    import pyhive.hive
  File "/usr/local/lib/python3.7/site-packages/pyhive/hive.py", line 337
    def execute(self, operation, parameters=None, async=False):
                                                      ^
SyntaxError: invalid syntax

but when i do the same in python 2.6 version i am not facing any errors

can you please help me with this, if its not possible with pyhive can you suggest some better options to connect to hive with python 3.6 or 3.7

Upvotes: 1

Views: 2166

Answers (2)

Anderson
Anderson

Reputation: 3247

I solved this problem by installing the following libraries.

thrift==0.11.0
thrift-sasl==0.2.1
bit-array==0.1.0
impyla==0.15.0
thriftpy==0.3.9

Upvotes: 0

Sunitha
Sunitha

Reputation: 12015

From python 3.7, async is a keyword and variables cant be named async. So pyhive package needs to be fixed, to work with python3.7

This should work fine with python 3.6, though

There was some discussion about fixing this @ https://github.com/dropbox/PyHive/issues/148. You may request the developers to get it fixed.

Upvotes: 2

Related Questions