Accessing Hive using Python

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.

The Hive Server usual runs on 10000 port. Please try.

Are you using our Lab or you are usualing the VM.

I am also facing same issue while deploying my code to azure portal using docker. In local I am able to connect to hive using pyhive and make query on hive table and expose data as rest but when the same application I am trying to deploy and run from azure portal getting below error-thrift.transport.TTransport.TTransportException: failed to resolve sockaddr for hive server
host:port.
using default port i.e. - 10000.
Kindly reply if you have got any resolution on this issue.Thank in advance.