MySQL Connector does not work with SQLAlchemy and Python 2.6

Bug #712037 reported by Ute Arbeit on 2011-02-02
This bug affects 3 people
Affects Status Importance Assigned to Milestone
MySQL Connector/Python
Status tracked in Trunk
Fix Committed
Geert JM Vanderkelen
Geert JM Vanderkelen

Bug Description

Connecting to a MySQL database using SQLAlchemy 0.6.6 / MySQL Connector 0.3.2 / Python 2.6 raises the exception
'MySQLConnection' object has no attribute 'get_characterset_info'

In the python2 branch the method 'get_characterset_info' is not defined on MySQLConnection in like it exists in the python3 branch. Instead a method 'get_charset' is defined.

With a quick and dirty fix by defining the method on the MySQLConnection object

    Fix to work with SQLAlchemy 0.6.6
    def get_characterset_info(self):
        return self.get_charset()

the connector works for me now.

Related branches

Changed in myconnpy:
assignee: nobody → Geert JM Vanderkelen (geertjmvdk)
Eric Ongerth (ericongerth) wrote :

Confirmed same problem but with Python 2.7, found the same fix myself before seeing this ticket.

The above is nice fix for MySQL Connector/Python, but eventually SQLAlchemy has to use MySQLConnection.charset.
Those things happen in development release and no much time to work on things..

Changed in myconnpy:
status: New → Won't Fix
Mike Bayer (zzzeek) wrote :

Hi Geert -

Did you make a backwards incompat change to the DBAPI ? Feel free to send SQLA a patch that supports the driver in the way you see fit... or perhaps leaving the previous method available for backwards compatibility with the code we got from you originally (the dialect was yours originally is that correct ? I can't find the original ticket...).

Yes, I should learn to keep stuff backward compatible.
It's good to use the charset-property, but we will leave the get_characterset_info() in.

I think I should give the SQLAlchemy dialect a checkup. I've got a patch somewhere. But I didn't write the original dialect, as far as I can remember :)


Changed in myconnpy:
importance: Undecided → High
status: Won't Fix → In Progress
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers