How to access hive using Python (Source code )

Use case : If you want to do some scheduling or some automation , we may need to access Hive using Python. 

Libraries used : impyla  ( 
Python version used : 3.6
Here our environment is AWS EMR with preconfigured

#Source Code - Python
#Code by
#For Learning purpose
#Python Hive
from impala.dbapi import connect
conn = connect(host='', port=10000, auth_mechanism='PLAIN')
cur = conn.cursor()
cur.execute("show databases")
dbs = cur.fetchall()
for db in dbs:

If you face any issue like “bitarray-1.6.1-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.” 

You may need to install one of the bellow based on your windows.

For 64 bit 
pip install

For 32 bit
pip install


Author: user

Leave a Reply