如何设置超集 SQLALCHEMY URI 以使用自定义身份验证连接 HiveServer2
how to set superset SQLALCHEMY URI to connect HiveServer2 with custom auth
Superset 想要连接 HiveServer2 数据源与自定义身份验证(即指定用户名和密码),python 下面的代码是可以的
from pyhive import hive
host_name = "192.168.0.38"
port = 10000
user = "admin"
password = "password"
database="test_db"
def hiveconnection(host_name, port, user,password, database):
conn = hive.Connection(host=host_name, port=port, username=user, password=password,
database=database, auth='CUSTOM')
cur = conn.cursor()
cur.execute('select item_sk,reason_sk, account_credit from returns limit 5')
result = cur.fetchall()
return result
但是如何设置超集SQLALCHEMY URI
?
hive://hive@{hostname}:{port}/{database}
请看:
https://github.com/apache/superset/discussions/18699#discussioncomment-2170334
hive://username:password@hostname:port/database?auth=CUSTOM
Superset 想要连接 HiveServer2 数据源与自定义身份验证(即指定用户名和密码),python 下面的代码是可以的
from pyhive import hive
host_name = "192.168.0.38"
port = 10000
user = "admin"
password = "password"
database="test_db"
def hiveconnection(host_name, port, user,password, database):
conn = hive.Connection(host=host_name, port=port, username=user, password=password,
database=database, auth='CUSTOM')
cur = conn.cursor()
cur.execute('select item_sk,reason_sk, account_credit from returns limit 5')
result = cur.fetchall()
return result
但是如何设置超集SQLALCHEMY URI
?
hive://hive@{hostname}:{port}/{database}
请看: https://github.com/apache/superset/discussions/18699#discussioncomment-2170334
hive://username:password@hostname:port/database?auth=CUSTOM