Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: update Python Client Driver per Brad Ruderman (user@hive, 2/3/2014)

...

A Python client driver for HiveServer2 is available at https://github.com/BradRuderman/pyhs2 (thanks, Brad). It includes all the required packages such as SASL and Thrift wrappers.

The driver has been certified for use with Python 2.6 and newer.

To use the pyhs2 driver:

No Format
pip install pyhs2

and then:

noformat
Code Block
language
py
import pyhs2

conn =with pyhs2.connect(host='localhost', 
					
                   port=10000,
					                   authMechanism="PLAIN", 
					
                   user='root', 
					
                   password='test', 
					
                   database='default')
cur = as conn:
    with conn.cursor() as cur:
    	#Show databases
    	print cur.getDatabases()

    	#Execute query
        cur.execute("show tablesselect * from table")
 
        #Return column info from query
        print cur.getSchema()

        #Fetch table results
        for i in cur.fetch():
	            print i
cur.close()
conn.close()

You can discuss this driver on the user@hive.apache.org mailing list.