hivefans Apr 23rd, 2019 (edited) 137 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ####python连接有kerberos验证的hiveserver2
  2. import pyhs2
  3. import thrift
  4. config = {'krb_host':'hiveserver-$', 'krb_service':'hiveserver','hive.server2.proxy.user':'ceshi'}
  5. db_conn=pyhs2.connect(host="hiveserver-$", 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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand