Release Notes for MariaDB Connector/Python 1.1.2

Overview

MariaDB Connector/Python is a native MariaDB connector for building Python applications on MariaDB. It is compliant with Python DB API 2.0 (PEP-249). It is written in Python and C and uses MariaDB Connector/C.

MariaDB Connector/Python 1.1.2 was released on 2022-06-27. MariaDB Connector/Python 1.1.2 is the first GA release of MariaDB Connector/Python 1.1.

Features

  • MariaDB Connector/Python 1.1 now supports Python 3.10.

    • The Py_TYPE macro has been replaced with the Py_SET_TYPE function to prepare MariaDB Connector/Python 1.1 for the upcoming Python 3.11 release. (CONPY-201)

  • All classes, including Cursor and Connection use native Python implementations for easier extension or modification. (CONPY-971)

  • When MariaDB Connector/Python 1.1 is built with MariaDB Connector/C 3.3, the connector supports connection failover between multiple server addresses defined in the connection string. (CONC-365, CONPY-44)

  • Parser checks whether to use binary or text protocol.

  • Cursor result-sets are buffered by default.

  • When an error related to parameters is encountered, an exception is raised as a ProgrammingError to comply with PEP-249. (CONPY-205)

    • In previous releases, a variety of exceptions could be raised, including TypeError and DataError.

  • When parameters are passed as a dictionary to methods like Cursor.execute, Connector/Python 1.1 no longer raises an error if the dictionary contains more keys than the number of placeholders in the cursor's SQL statement. (CONPY-205)

Constants

  • New constants in the mariadb.constants.CLIENT module can be used to check the capabilities of the remote server when establishing a connection.

  • New constants in the mariadb.constants.FIELD_FLAGS module represent the various field flags.

    • As an addition to the DBAPI 2.0 standard (PEP-249) these flags are returned as eighth element of the Cursor.description attribute.

  • New constants in the mariadb.constants.STATUS module describe the current status of the database server.

  • New constants in the mariadb.constants.ERR module make errors easier to understand. (CONPY-203)

Methods and Attributes

  • executemany() method optimized to reduce GIL lock releases.

  • MariaDB Connector/Python 1.1 defines the repr() method for the Connection, Cursor, and ConnectionPool classes, so that objects of those classes can be implicitly converted to strings in error messages and debugging output. (CONPY-184)

  • New attributes can be used to obtain the version of MariaDB Connector/C. (CONPY-162)

    • The new mariadb.client_version attribute is an integer that provides the version in the following format:

      MAJOR_VERSION * 10000 + MINOR_VERSION * 1000 + PATCH_VERSION
      
    • The new mariadb.client_version_info attribute provides the version as a tuple in the following format: (MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION).

Connection Class Methods

  • The new Connection.begin() method starts a new transaction.

  • The new Connection.select_db() method changes the connection's default database.

  • The new Connection.show_warnings() method shows errors, warnings, and note messages from the last statement executed by the connection.

  • The new Connection.dump_debug_info() method can dump status information about the connection into the server-side logs when the user has the SUPERSUPER privilege. (CONPY-204)

Connection Class Attributes

  • The new Connection.client_capabilities attribute shows the capabilities of the client library.

  • The new Connection.server_capabilities attribute shows the capabilities of the connected database server.

  • The new Connection.server_status attribute shows the current server status.

  • The new Connection.open attribute shows whether the connection is alive.

ConnectionPool Class Attributes

  • The new ConnectionPool.connection_count attribute returns the number of connections in a pool.

  • The new ConnectionPool.reset_connection attribute, if set to true, resets the connection on both client and server side after the close() method has been called.

Cursor Class Attributes

  • The new Cursor.buffered attribute indicates whether the cursor should buffer result-sets and defaults to True.

  • The new Cursor.paramcount attribute indicates the number of parameters in a statement.

  • The existing Cursor.description attribute has been extended to provide the table name (descriptor[8]), the original column name (descriptor[9]), and the original table name (descriptor[10]). (CONPY-88)