gpt4 book ai didi

python - 连接到 redshift : "server certificate does not match host name" 时出错

转载 作者:太空狗 更新时间:2023-10-30 02:38:48 26 4
gpt4 key购买 nike

尝试在 redshift 上运行查询后,我收到以下错误消息:

OperationalError: (psycopg2.OperationalError) server certificate for "" does not match host name "".

我已经安装了 sqlalchemy-redshift 包,以及 Psycopg2 包。我的代码:

from sqlalchemy import create_engine

def run_query(query, connection_string):

red_engine = create_engine(connection_string)
data_set = pd.read_sql_query(query, red_engine)

return data_set

完全相同的代码在另一台计算机上确实有效,因此我们确信登录名、密码和查询是正确的,并且问题是我的计算机特有的。有什么建议吗?

最佳答案

这最终对我有用:我们在代码中添加了首选 sslmode,如下所示:

create_engine(connection_string, connect_args={'sslmode': 'prefer'})

关于python - 连接到 redshift : "server certificate does not match host name" 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46033456/

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