Python Forum

Full Version: Python-Hive connectivity issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
We have Virtual Private network in which we have Windows Server box, and Hadoop Distribution based on Hortonworks installed on several data nodes on Redhat.

The Python script is installed on Windows machine and we are trying to access Hive tables available on the said Hadoop cluster.
On Hive 10000 port number is open to listen to the external requests.

From Windows box ODBC connectivity is working fine with said port, but below mentioned Python script is failing to execute with errors.

For that we have installed some mandatory packages which are needed for the hive connection as below;
• pyhive
• sasl
• thrift-sasl
• pure-sasl

Please find below code:

from pyhive import hive
from TCLIService.ttypes import TOperationState
import sasl
import thrift
import pandas as pd
import pyhs2

cursor = hive.connect(host='dnanoripaihos01.retailaip.local', auth='KERBEROS', port='10000',kerberos_service_name='hive').cursor()
cursor.execute('SELECT * FROM cancellations LIMIT 50')
print (cursor.fetchall()) 
When we execute this script it gives us below error:

Error:
Traceback (most recent call last): File "C:\Users\rekha.b.gaonkar\Desktop\load_hive_table.py", line 9, in <module> cursor = hive.connect(host='dnanoripaihos01.retailaip.local', auth='KERBEROS', port='10000',kerberos_service_name='hive').cursor() File "<C:\Program Files (x86)\Python37-32\lib\site-packages\pyhive\hive.py>", line 94, in connect return Connection(*args, **kwargs) File "<C:\Program Files (x86)\Python37-32\lib\site-packages\pyhive\hive.py>", line 192, in __init__ self._transport.open() File "<C:\Program Files (x86)\Python37-32\lib\site-packages\thrift_sasl\__init__.py>", line 79, 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'
Please help us to resolve this issue.