hivefans icon

hiveserver2.py

hivefans | PRO | 04/24/19 03:01:16 AM UTC | 0 ⭐ | 1051 👁️ | Never ⏰ | []
Python |

450 B

|

None

|

0 👍

/

0 👎

####python连接有kerberos验证的hiveserver2
import pyhs2
import thrift
config = {'krb_host':'hiveserver-$clustername.s3s.altiscale.com', 'krb_service':'hiveserver','hive.server2.proxy.user':'ceshi'}
db_conn=pyhs2.connect(host="hiveserver-$clustername.s3s.altiscale.com", port=10000, authMechanism="KERBEROS", user="", password="", configuration=config)
cur = db_conn.cursor()
cur.execute("use default")
cur.execute("show tables")
for i in cur: print i

Comments