PyHive Connection Error - Could not start SASL

1.1k views Asked by At

I'm trying to connect to Hive server with PyHive. So far, I have this:

from pyhive import hive
import pandas as pd

# Create Hive connection
conn = hive.Connection(host="*********", port=10000, auth='NONE')

df = pd.read_sql("select max_temperature_f from `201402_weather_data` LIMIT 10", conn)
print(df.head())

In my hive-site.xml configuration I have this:

<property>
<name>hive.server2.authentication</name>
<value>NONE</value>
<final>false</final>
<source>programmatically</source>
<source>org.apache.hadoop.hive.conf.LoopingByteArrayInputStream@56f71edb</source>
</property>

and

<property>
<name>hive.server2.transport.mode</name>
<value>binary</value>
<final>false</final>
<source>programmatically</source>
<source>org.apache.hadoop.hive.conf.LoopingByteArrayInputStream@56f71edb</source>
</property>

From what I read, these are the correct settings with which I could connect to the hive server (assuming that I want NONE for authentication). Executing the script I get an error:

Traceback (most recent call last):
  File "D:/****/hive_connector.py", line 8, in <module>
    auth='NONE')
  File "C:\Users\***\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyhive\hive.py", line 192, in __init__
    self._transport.open()
  File "C:\Users\***\AppData\Local\Programs\Python\Python37-32\lib\site-packages\thrift_sasl\__init__.py", line 85, in open
    message=("Could not start SASL: %s" % self.sasl.getError()))
thrift.transport.TTransport.TTransportException: Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: Unable to find a callback: 2'

I'm using windows, so I had to manually download and install SASL - sasl-0.2.1-cp37-cp37m-win32.whl

I'm using:

PyHive - 0.6.3, sasl - 0.2.1, thrift - 0.13.0, thrift-sasl - 0.4.2, thriftpy2 - 0.4.11 (not sure where that came from)

I've seen a lot of questions and I've tried several things but I'm not able to run the script successfully. Can you point me to the correct solution? Is it the sasl package that is causing the problems?

0

There are 0 answers