Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

connect hive running on remote host using python with username pwd like we connect in hive-view2.0

avatar

connect hive running on remote host using python with username pwd like we connect in hive-view2.0.

5 REPLIES 5

avatar
Master Mentor

@Venkatachalam Subramanian

I have not tested the following on my own but looks like you can try the following kind of Python Scripts (Utilities) to connect to a remote Hive with username & password:

https://github.com/CERT-BDF/TheHive4py

https://github.com/ianbuss/example-clients/blob/master/hive/src/main/python/exampleclients/hive-clie...

https://github.com/dropbox/PyHive

.

avatar
Master Mentor

avatar

I found all these by googling but

1) pyhs2 - discontinued

2) pyHive- cant find an example to connect remote host using username/pwd ( not ldap)

can u show be an example code of how to connect to remote hive host using python.

avatar

I couldnt use pyHive.

however I was able to use pyhs2. If you are getting any errors like {Error in sasl_client_start (-4) SASL(-4): no mechanism available: No worthy mechs found}, then make sure u have installed cyrus-sasl-plain

yum install cyrus-sasl-plain

avatar

ok after going through the source code of PyHive, I understood that pip install PyHive install a different code than the one at https://github.com/dropbox/PyHive (even though the version are the same)

1) so I uninstalled previous version of pyhive

2) downloaded the souce from https://github.com/dropbox/PyHive and installed this

3) now im able to connect to remote hive using username/password

---- code -----

from pyhive import hive
conn = hive.Connection(host="<host>", port=10000, username="<username>", password="<your pwd>", auth='CUSTOM')
cur = conn.cursor()
cur.execute('select * from <table>');
print cur.fetchone()