我怎样才能用键盘连接到黑斑羚?

2024-06-16 09:11:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图通过Python脚本建立一个与impala数据库的连接,使用keytab,而不是普通的用户/密码组合,但是我无法找到任何在线教程,我当前使用的代码是:

conn = connect(host=impala_host, port=impala_port, use_ssl=True, auth_mechanism="PLAIN", user=username, password=pwd, database=impala_db)
cursor = conn.cursor() 

但是,我想用keytab而不是我的密码连接。在


Tags: 代码用户脚本数据库truehost密码ssl
1条回答
网友
1楼 · 发布于 2024-06-16 09:11:33

您似乎正在尝试使用该库:https://github.com/cloudera/impyla

请查看中的用法部分自述文件.md在那里:

from impala.dbapi import connect
conn = connect(host='my.host.com', port=21050)
cursor = conn.cursor()
cursor.execute('SELECT * FROM mytable LIMIT 100')
print cursor.description  # prints the result set's schema
results = cursor.fetchall()
...
...

相关问题 更多 >