I’m trying to access Hive using the below python script.
from pyhive import hive
from thrift.transport import TSocket
conn=hive.Connection(“host=127.0.0.1 port=9000 username=hadoop”)
cur=conn.cursor()
cur.execute(‘SELECT * FROM userdb.user_table’)
conn.close()
I’m getting the below error:
ERROR:thrift.transport.TSocket:failed to resolve sockaddr for 127.0.0.1,9000:9090
Traceback (most recent call last):
File “/home/hadoop/anaconda2/lib/python2.7/site-packages/thrift/transport/TSocket.py”, line 95, in open
addrs = self._resolveAddr()
File “/home/hadoop/anaconda2/lib/python2.7/site-packages/thrift/transport/TSocket.py”, line 42, in _resolveAddr
socket.AI_PASSIVE | socket.AI_ADDRCONFIG)
gaierror: [Errno -2] Name or service not known
Traceback (most recent call last):
File “hiveConn.py”, line 8, in
transp.open()
File “/home/hadoop/anaconda2/lib/python2.7/site-packages/thrift/transport/TSocket.py”, line 99, in open
raise TTransportException(TTransportException.NOT_OPEN, msg)
thrift.transport.TTransport.TTransportException: failed to resolve sockaddr for 127.0.0.1,9000:9090
#########################################################
Please help in understanding and resolving this error.