gpt4 book ai didi

sql - 如何在 SQLAlchemy > Presto 连接中指定 https 协议(protocol)?

转载 作者:行者123 更新时间:2023-12-04 08:57:19 25 4
gpt4 key购买 nike

我正在尝试使用 SQLAlchemy 通过 Presto 运行 Hive 查询。它使用 LDAP 身份验证,但我在连接字符串中遗漏了一些内容。

from sqlalchemy.engine import create_engine

conn_string = 'presto://' + user + ':' + passw + '@' + host + ':' + port + db \
+ ", connect_args={'auth':LDAP}"

eng = create_engine(conn_string)
我收到一条错误消息:
Protocol must be https when passing a password
我在搜索时看到了一些关于此的讨论,但没有看到明确的解决方案。我已经尝试了很多有或没有端口、数据库等的组合。你知道怎么做吗?谢谢!

最佳答案

我最终使用了一个不同的库:

import prestodb

conn=prestodb.dbapi.connect(
host=host,
port=port,
user=user,
catalog='db_name',
schema='my_schema',
http_scheme='https',
auth=prestodb.auth.BasicAuthentication(user, passw)
)
然后我能够检索结果并放入数据框中。所以不需要 SQLAlchemy。这似乎是不必要的复杂。

关于sql - 如何在 SQLAlchemy > Presto 连接中指定 https 协议(protocol)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63745779/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com