0 votes
1 view
in Big Data Hadoop & Spark by (92.8k points)

I have installed HDP 2.5 Sandbox on my windows system. I want to access Hive running on Sandbox using Python (to be specific "pyhive" library). 

I can log in to the HDP. The IP address is 127.0.0.1. I have installed a pyhive library. However, I am unable to connect from the system to Sandbox from python. 

Can you suggest what to do?

1 Answer

0 votes
by (43.2k points)

The following code represents how we can connect to Hive using pyhive:

from pyhive import hive

import pandas as pd

#Create Hive connection 

conn = hive.Connection(host="127.0.0.1", port=10000, username="username")

# Read Hive table and Create pandas dataframe

df = pd.read_sql("SELECT * FROM db_Name.table_Name limit 10", conn)

print(df.head())

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...