Documentation Home
MySQL Connector/Python Release Notes
Related Documentation Download these Release Notes
PDF (US Ltr) - 229.0Kb
PDF (A4) - 229.9Kb


MySQL Connector/Python Release Notes  /  Changes in MySQL Connector/Python 2.2  /  Changes in MySQL Connector/Python 2.2.2 (2016-12-01, Development Milestone)

Changes in MySQL Connector/Python 2.2.2 (2016-12-01, Development Milestone)

Functionality Added or Changed

  • If the MySQL server is configured to support encrypted connections, Connector/Python now attempts to establish an encrypted connection by default, falling back to an unencrypted connection otherwise. This is behavior similar to the --ssl-mode=PREFERRED option supported by MySQL client programs.

    The following TLS/SSL options have been implemented for the mysqlx URI type string connection schema. All require Python 2.7.9 or higher.

    • ssl-enable: This option enforces SSL connections. If given, a connection attempt must be able to establish an encrypted connection or the attempt fails.

    • ssl-ca: This option is used to verify the server certificate.

    • ssl-cert, ssl-key: These options are used to pass the client certificate and key, but the server currently does not validate the client using these.

    The ssl-enable parameter can be specified in a parameter dictionary or URL, like this:

    mysqlx.get_session({"user": "root", "host": "localhost", "port": 33060,
                        "password": "pass", "ssl-enable": True})

    Or:

    mysqlx.get_session("mysqlx://root:pass@localhost?ssl-enable")

    The other parameters are used similarly. In a URI type string, path name values should be given within parentheses; for example, ssl-cert=(path_name). See Connecting Using a URI or Key-Value Pairs. (Bug #24954646)

  • There is now a standard API to create a table: Schema objects have a create_table function. It throws an error if the table exists.

  • For any method that takes a value list of parameters for its argument, there is now more flexibility with how the parameters can be specified: Either as a value list or a list of individual parameters. For example, these method calls are the same:

    Collection.add([{"a": 27}, {"a": 28}])
    Collection.add({"a": 27}, {"a": 28})
  • For Schema objects, get_view, create_view, alter_view, and drop_view functions were added to support retrieval, create, alter, and drop operations on View objects.

  • On Unix and Unix-like systems, Unix domain socket files are now supported as a connection transport. The socket file can be specified in a parameter dictionary or URL, like this:

    mysqlx.get_session({"user": "root", "password": "pass",
                       "socket": "/path/to/socket"})

    Or:

    mysqlx.get_session("mysqlx://user:pass@(/path/to/sock)/schema")
    mysqlx.get_session("mysqlx://user:pass@/path%2Fto%2Fsock/schema")
    mysqlx.get_session("mysqlx://user:pass@.%2Fpath%2Fto%2Fsock/schema")
    mysqlx.get_session("mysqlx://user:pass@..%2Fpath%2Fto%2Fsock/schema")

Bugs Fixed

  • For a user created with REQUIRE SSL, establishing an SSL connection by specifying --ssl-key but not --ssl-ca or --ssl-cert fails for standard MySQL client programs. The same connection configuration was (improperly) permitted in Connector/Python. (Bug #24953032)

  • Connection failures due to an improper SSL CA resulted in an uninformative error message. (Bug #24948054)

  • Using a schema object to alter a view failed if the view selected from a non-INFORMATION_SCHEMA table and it was altered to select from an INFORMATION_SCHEMA table. (Bug #24947078)

  • schema.create_collection() with an empty collection name threw an improper error. (Bug #24520850)