Advertisement
hivefans

hiveserver2.py

Apr 23rd, 2019
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. ####python连接有kerberos验证的hiveserver2
  2. import pyhs2
  3. import thrift
  4. config = {'krb_host':'hiveserver-$clustername.s3s.altiscale.com', 'krb_service':'hiveserver','hive.server2.proxy.user':'ceshi'}
  5. db_conn=pyhs2.connect(host="hiveserver-$clustername.s3s.altiscale.com", port=10000, authMechanism="KERBEROS", user="", password="", configuration=config)
  6. cur = db_conn.cursor()
  7. cur.execute("use default")
  8. cur.execute("show tables")
  9. for i in cur: print i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement