Error connecting hive using python pyhs2

0 votes

I am trying to access hive using pyhs2. I tried the following code:

example.py

import pyhs2
conn = pyhs2.connect(host='localhost', port=10000, user=None, password=None,database='default')
with conn.cursor() as new_cur:
        new_cur.execute("select * from table")
        for i in new_cur.fetch():
            print i

I am getting the following error:

    Traceback (most recent call last):
 File "example.py", line 2, in <module> conn = pyhs2.connect(host='localhost', port=10000,user=None, password=None,database='default')
      
    thrift.transport.TTransport.TTransportException: Could not connect to localhost:10000
Jan 11, 2019 in Big Data Hadoop by slayer
• 29,350 points
1,963 views

1 answer to this question.

0 votes

Seems like the host IP is not right. Find out the right IP address. If you are using Linux then you can use the following command to get the host IP address

hostname -I

After this, replace the right IP address in the code and it should work.

answered Jan 11, 2019 by Omkar
• 69,210 points

Related Questions In Big Data Hadoop

0 votes
1 answer

Error running hadoop mapreduce in Python using Hadoop Streaming

Hi As you write mapper and reducer program  ...READ MORE

answered Jan 21, 2020 in Big Data Hadoop by anonymous
2,170 views
+3 votes
1 answer

Getting Connection Error while loading data into table using cloudera hive

Hey Nafeesa, Itseems that Hive is not able ...READ MORE

answered Oct 4, 2018 in Big Data Hadoop by Vardhan
• 13,190 points
700 views
0 votes
1 answer

Getting error while building Hadoop core jar using ant.

I think you are missing libtool library. ...READ MORE

answered Apr 18, 2018 in Big Data Hadoop by coldcode
• 2,080 points
765 views
0 votes
1 answer

Setting Hive/Hadoop property using Hive Query

You can set Hadoop & Hive conf ...READ MORE

answered Apr 18, 2018 in Big Data Hadoop by Shubham
• 13,490 points
1,667 views
0 votes
1 answer

Connect to Hive using Pyhive

Here's how we can connect to Hive ...READ MORE

answered Jan 8, 2019 in Big Data Hadoop by Omkar
• 69,210 points
5,077 views
0 votes
0 answers

try except is not working while using hdfs command

Hi,  I am trying to run following things ...READ MORE

Mar 6, 2019 in Python by anonymous
932 views
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
10,555 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
2,184 views
0 votes
1 answer

Error while connecting to Hive using Java JDBC

Use ​org.apache.hive.jdbc.HiveDriver as your driver ...READ MORE

answered Nov 22, 2018 in Big Data Hadoop by Omkar
• 69,210 points
1,560 views
0 votes
1 answer

How to Access Hive via Python?

The easiest way is to use PyHive. To ...READ MORE

answered Oct 9, 2018 in Big Data Hadoop by Omkar
• 69,210 points
16,472 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP