python大数据

使用impyla连接TDH平台inceptor

2019-01-16  本文已影响0人  八幡大老师

基于python2.7

安装

impyla安装依赖以下模块:

安全模式下连接

经过测试,impyla可以连接配置安全认证的inceptor,在连接参数指定上选择:
auth_mechanism="PLAIN"

连接代码:

conn = connect(host='inceptor.server.ip', port=10000,user="dw",password="123456",database="default",auth_mechanism="PLAIN")
cursor = conn.cursor()

执行数据库命令:

cursor.execute('show databases')
print cursor.description # prints the result set's schema
results = cursor.fetchall()

执行DDL语句:

cursor.execute('create table test( a string)')
print cursor.description  
上一篇下一篇

猜你喜欢

热点阅读