The Wayback Machine - https://web.archive.org/web/20201103005538/https://github.com/PyMySQL/PyMySQL/pull/903
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MySQL Connector/Python compatible SSL options. #903

Open
wants to merge 2 commits into
base: master
from

Conversation

@moriyoshi
Copy link

@moriyoshi moriyoshi commented Nov 2, 2020

Background of the modification

This patch adds a bunch of connection arguments that are compatible with MySQL Connector/Python.
https://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.html

The rationale for the change is that SQLAlchemy propagates the parameters specified in the DSN's query to the constructor arguments as they are, which means it cannot build a structured parameter to give it to the underlying connection factory.
MySQL Connector/Python can take unstructued TLS parameters so it plays well with SQLAlchemy.

Details

This patch adds the following arguments:

  • ssl_ca: Path to the file that contains a PEM-formatted CA certificate
  • ssl_cert: Path to the file that contains a PEM-formatted client certificate
  • ssl_disabled: A boolean value that disables usage of TLS
  • ssl_key: Path to the file that contains a PEM-formatted private key for the client certificate
  • ssl_verify_cert: Set to true to check the validity of server certificates
  • ssl_verify_identity: Set to true to check the server's identity

This patch also introduces the following key for the dictionary that is supposed to be passed through ssl argument, which effectively closes #842.

  • verify_mode: none for ssl.CERT_NONE, optional for ssl.CERT_OPTIONAL and required for ssl.CERT_REQUIRED
@moriyoshi moriyoshi changed the title Add MySQL Connector/Python compatible SSL options. Also fixes #842. Add MySQL Connector/Python compatible SSL options. Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

1 participant
You can’t perform that action at this time.