Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> Hive Server 2 Python Client Drivers

Copy link to this message
Re: Hive Server 2 Python Client Drivers
excellent.  you might try to get it mentioned on this page:


and save some other poor saps from re-inventing the wheel.

On Wed, Oct 23, 2013 at 2:42 PM, Brad Ruderman <[EMAIL PROTECTED]>wrote:

> Hi All-
> I have struggled for awhile with a simple and straightforward driver that
> I can use to connect to Hive Server 2 in a very similar manner as a mysql
> driver in python. I know there are a few ways like using thrift or ODBC but
> all require significant amount of installation. I decided to create my own
> package that includes all the required packages such as SASL and Thrift
> wrappers to connect. It is called pyhs2 and is avaliable here:
> https://github.com/BradRuderman/pyhs2
> To use simply:
> pip install pyhs2
> then:
> import pyhs2
> conn = pyhs2.connect(host='localhost',
> port=10000,
> authMechanism="PLAIN",
> user='root',
> password='test',
> database='default')
> cur = conn.cursor()
> cur.execute("show tables")
> for i in cur.fetch():
> print i
> cur.close()
> conn.close()
> Feel free to use it, I plan to add additional functionality and fix any bugs that exist. Most of the code was repurposed from a variety of sources. I hope you find it useful, please let me know if you have any questions.
> Thanks,
> Brad