问题
When I use SQLAlchemy with an external postgreSQL server, is the connection secured/encrypted?
from sqlalchemy.engine import create_engine
engine = create_engine('postgresql://scott:tiger@ip:5432/mydatabase')
What about psycopg2?
回答1:
Your connection string does not indicate secure connection. However, sometimes connection might be secure nevertheless, but it is unlikely.
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
is the highest level SSL connection validation where the client performs full SSL certificate check for the connection.
More info:
- https://www.postgresql.org/docs/current/static/libpq-ssl.html
来源:https://stackoverflow.com/questions/39813312/is-sqlalchemy-psycopg2-connection-to-postgresql-database-encrypted