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,370 points
2,421 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,220 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,587 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,150 points
1,018 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,090 points
1,006 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
2,006 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,220 points
5,425 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
11,072 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,571 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
109,055 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,220 points
1,871 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,220 points
17,278 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