from impala.dbapiimport connect
# 需要注意的是这里的auth_mechanism必须有,但database不必须
conn = connect(host='172.26.136.230', port=10000 ,auth_mechanism='PLAIN')
cur = conn.cursor()
cur.execute('SHOW DATABASES')
print(cur.fetchall())
cur.execute('SHOW Tables')
print(cur.fetchall())
cur.close()
conn.close()
网友评论