MySQL Forums
Forum List  »  Announcements

MySQL Connector/Python 2.0.0 Alpha has been released
Posted by: Sowmya Dass
Date: July 24, 2014 11:56AM

Dear MySQL users,

MySQL Connector/Python 2.0.0-alpha is the first alpha version of
2.0 release series of the pure Python database driver for MySQL.
It is intended to introduce users to the new features.

This release is not feature complete but it should be stable
enough for users to understand the new features and how we
expect them to work.

As is the case with all non-GA releases, it should not be used
in any production environment.

MySQL Connector/Python version 2.0.0-alpha is compatible with MySQL
Server versions 5.5 and greater. Python 2.6 and greater as well as
Python 3.3 and greater are supported. Python 2.4, 2.5 and 3.1, 3.2
are not supported.

MySQL Connector/Python 2.0.0-alpha is available for download from:
http://dev.mysql.com/downloads/connector/python/#downloads

The ChangeLog file included in the distribution contains a brief summary
of changes in MySQL Connector/Python 2.0.0. For a more complete list of
changes, see below or online at:
http://dev.mysql.com/doc/relnotes/connector-python/en/

=========================================================================

Changes in MySQL Connector/Python 2.0.0 (2014-07-24, Alpha)

   Functionality Added or Changed

     * Incompatible Change: Previous series of Connector/Python had
       separate Python 2 and Python 3 code bases. For
       Connector/Python 2.0, the source tree has been reorganized to
       have a single code base, for easier maintenance, testing, and
       distribution.
       This reorganization results in an incompatible change in
       behavior: With the use of "raw" cursors, the returned values
       is of the bytearray type. This is necessary for having both
       Python 2 and 3 return the same data. Consider the following
       example:
       import mysql.connector

       cnx = mysql.connector.connect(raw=True)
       cursor = cnx.cursor()
       cursor.execute('SELECT 1')
       print(cursor.fetchall())
       In Connector/Python 1.x, the output is:

          + Using Python 2: [('1',)]

          + Using Python 3: [(b'1',)]
       In Connector/Python 2.0, for both Python versions, the output
       is: [(bytearray(b'1'),)]
       To get the same value as in Connector/Python 1.x, do this:

          + Using Python 2: str(bytearray(b'1'))

          + Using Python 3: bytes((bytearray(b'1'))

     * Important Change: Previously, to enable use of LOAD DATA LOCAL
       INFILE, clients had to explicitly set the
       ClientFlag.LOCAL_FILES flag. This flag is now enabled by
       default. To disable it, the allow_local_infile option for
       connect()can be set to False.

     * For a stored procedure that produces multiple result sets, it
       is now possible possible to execute the procedure and process
       its results by executing a CALL statement. Execute the
       statement using execute() with a multi=True argument, and use
       the returned iterator to process each result in turn. (Bug
       #73291, Bug #19207922)

     * The packaging modules and supporting files have been removed
       from the main repository and from the source packages for
       Connector/Python. They are still available in the
       Connector/Python 1.x series.

     * The mysql.connector.cursor module supports four new cursor
       classes:

          + The MySQLCursorDict cursor class returns each row as a
            dictionary. The keys for each dictionary object are the
            column names of the MySQL result.
            cursor = cnx.cursor(dictionary=True)

          + The MySQLCursorBufferedDict cursor class is like
            MySQLCursorDict, but fetches the entire result set after
            executing the query and buffers the rows.
            cursor = cnx.cursor(dictionary=True, buffered=True)

          + The MySQLCursorNamedTuple cursor class returns each row
            as a named tuple. Each column is accessible through an
            attribute of the tuple-like object.
            cursor = cnx.cursor(named_tuple=True)

          + The MySQLCursorBufferedNamedTuple cursor class is like
            MySQLCursorNamedTuple, but fetches the entire result set
            after executing the query and buffers the rows.
            cursor = cnx.cursor(named_tuple=True, buffered=True)
            For more information, see cursor.MySQLCursor Subclasses
            (http://dev.mysql.com/doc/connector-python/en/connector-python
            -api-cursor-subclasses.html).

     * Connector/Python now supports option files using two new
       options for connect():

          + option_files: Which option files to read. The value can
            be a file path name (a string) or a sequence of path name
            strings. By default, Connector/Python reads no option
            files, so this argument must be given explicitly to cause
            option files to be read. Files are read in the order
            specified.

          + option_groups: Which groups to read from option files, if
            option files are read. The value can be an option group
            name (a string) or a sequence of group name strings. If
            this argument is not given, the default value is
            ['client, 'connector_python'] to read the [client] and
            [connector_python] groups.
            For more information, see Connector/Python Option-File Support
            (http://dev.mysql.com/doc/connector-python/en/connector-python
            -option-files.html).

   Bugs Fixed

     * Fetching results from a prepared statement that returned many
       columns could produce an error. (Bug #72602, Bug #18742429)

     * Previously, a RuntimeError exception was raised when a Django
       application was inactive for a while. Now, the Django backend
       verifies that the database connection is still valid each time
       a database request is made. (Bug #72545, Bug #18843153)

     * Django TimeField values of 00:00:00 were incorrectly converted
       to NULL because Python considered that value equal to False.
       (Bug #72732, Bug #18956789)


Documentation
--------------------
Online:http://dev.mysql.com/doc/connector-python/en/index.html 
The source distribution includes the manual in various formats under
the docs/ folder.

Reporting Bugs
--------------------
We welcome and appreciate your feedback and bug reports:
http://bugs.mysql.com/ 

Enjoy !

On Behalf of the MySQL RE team at Oracle,
Sowmya Dass

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL Connector/Python 2.0.0 Alpha has been released
4515
July 24, 2014 11:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.