MySQL Connector/Python Release Notes

2.25 Changes in MySQL Connector/Python 8.0.13 (2018-10-22, General Availability)

Functionality Added or Changed

  • Added Python 3.7 support. (Bug #27081809, Bug #87818, WL #12239)

  • To go with the existing mysqlx.get_session(conn_str) method, a new mysqlx.get_client(conn_str, options) method was added that creates a connection pool handler that provides a get_session() method to create and retrieve connections from the pool. The collection pooling options are:

    • enabled: enables or disables connection pooling; boolean and defaults to true.

    • max_size: maximum number of connections available in the pool; positive integer and defaults to 25.

    • max_idle_time: maximum number of milliseconds a connection can be idle in the queue before being closed; integer >= 0 and defaults to 0 (infinite).

    • queue_timeout: maximum number of milliseconds a request will wait for a connection to become available; integer >= 0 and defaults to 0 (infinite).

      This is different than connect_timeout that's used for non-pooling. In a pooling scenario there are already connections in the pool, so queue_timeout controls how long to wait for a connection in the pool.

    Example usage:

    client = mysqlx.get_client(
        {
        'host': 'localhost',
        'port': 33060,
        'user': 'mike',
        'password': 'password'
        },
        { pooling: { 
            enabled: true, 
            max_idle_time: 5000, 
            max_size: 25, 
            queue_timeout: 20000 
            }
        }
    )
    

    Closing a session attached to the pool makes the connection available in the pool for subsequent get+session() calls, while closing (destroying) the pool effectively closes all server connections. (WL #11897)

  • Added a connection-timeout connection timeout query parameter. This defines the length of time (milliseconds) the client waits for a MySQL server to become available in the given network addresses. It was added to both the mysqlx.get_session() (non-pooling sessions) and mysqlx.get_client() (pooling sessions) interfaces. This option defaults to 10000 (10 seconds). The value 0 disables the timeout so the client will wait until the underlying socket (platform dependent) times out.

    Example usages:

    mysqlx.get_session("root@localhost?connect-timeout=0");
    mysqlx.get_session("root@[localhost:33060, 127.0.0.1:33060]?connect-timeout=5000");
    

    In a multi-host scenario, the connect-timeout value applies to each individual host. (WL #12226)

Bugs Fixed

  • On Windows, the 32-bit MSI failed to install. The registry key path was updated to allow the CEXT prerequisite check to execute and pass. (Bug #28395599, Bug #28464866)

  • Subsequent collection.add() method calls would leak memory if the C extension was enabled. (Bug #28278352)

  • Missing bind() parameters could cause an unclear error message or unexpectedly halt. (Bug #28037275)

  • The username and password fields are now quoted to allow special characters when making X DevAPI connections. (Bug #27528819, Bug #89614)