| Bug #71729 | Raise nicer error when unconvertible Python type is given | ||
|---|---|---|---|
| Submitted: | 15 Feb 2014 7:09 | Modified: | 7 May 2014 14:46 |
| Reporter: | Geert Vanderkelen | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / Python | Severity: | S3 (Non-critical) |
| Version: | 1.1.5 | OS: | Any |
| Assigned to: | Peeyush Gupta | CPU Architecture: | Any |
[7 May 2014 14:46]
Paul DuBois
Noted in 1.2.2 changelog. when MySQLCursor.execute() was passed values of a data type which cannot be converted, the exception raised was not easy to understand. Now a nicer error message is displayed when unconvertible Python types are given.

Description: The exception raised when passing MySQLCursor.execute() values of a data type which can not be converted is a bit cryptic. For example: mysql.connector.errors.ProgrammingError: Failed processing format-parameters; 'MySQLConverter' object has no attribute '_uuid_to_mysql' How to repeat: >>> import mysql.connector >>> cnx = mysql.connector.connect(user='root', database='test') >>> cur = cnx.cursor() >>> cur.execute("SELECT 1 FROM dual WHERE id = %s", (uuid.uuid4(),)) .. mysql.connector.errors.ProgrammingError: Failed processing format-parameters; 'MySQLConverter' object has no attribute '_uuid_to_mysql' Suggested fix: We can for example say that the type can't be converted instead of saying 'has no attribute'.