Add MySQL Connector/Python compatible SSL options. #903
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 certificatessl_cert
: Path to the file that contains a PEM-formatted client certificatessl_disabled
: A boolean value that disables usage of TLSssl_key
: Path to the file that contains a PEM-formatted private key for the client certificatessl_verify_cert
: Set to true to check the validity of server certificatesssl_verify_identity
: Set to true to check the server's identityThis 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
forssl.CERT_NONE
,optional
forssl.CERT_OPTIONAL
andrequired
forssl.CERT_REQUIRED