SQLAlchemy/psycopg2 连接到 PostgreSQL 数据库是否加密 [英] Is SQLAlchemy/psycopg2 connection to PostgreSQL database encrypted

查看:81
本文介绍了SQLAlchemy/psycopg2 连接到 PostgreSQL 数据库是否加密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将 SQLAlchemy 与外部 postgreSQL 服务器一起使用时,连接是否安全/加密?

When I use SQLAlchemy with an external postgreSQL server, is the connection secured/encrypted?

<代码>从 sqlalchemy.engine 导入 create_engineengine = create_engine('postgresql://scott:tiger@ip:5432/mydatabase')

psycopg2 怎么样?

What about psycopg2?

推荐答案

您的连接字符串不表示安全连接.然而,有时连接可能仍然是安全的,但不太可能.

Your connection string does not indicate secure connection. However, sometimes connection might be secure nevertheless, but it is unlikely.

要安全连接到 PostgreSQL 数据库,您可以使用 sslmode 参数.

To have a secure connection to PostgreSQL database you can use sslmode parameter.

 engine = create_engine('postgresql://scott:tiger@ip:5432/mydatabase?sslmode=verify-full')

verify-full 是最高级别的 SSL 连接验证,客户端对连接执行完整的 SSL 证书检查.

verify-full is the highest level SSL connection validation where the client performs full SSL certificate check for the connection.

更多信息:

这篇关于SQLAlchemy/psycopg2 连接到 PostgreSQL 数据库是否加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆