Wrong number of arguments during string formatting
Been working on a project with the MySQL connector and it's been pretty painful. The docs don't seem to be very complete...
(1) Does dict substitution work if the same value appears multiple times? It seems not to. For example:
INSERT INTO some_table ( id, name ) VALUES ( %(id)s, %(name)s) ) ON DUPLICATE UPDATE some_table SET name = %(name)s WHERE id = %(id)s
Here name is used once, though it's only in the dict once of course.
This has inevitably lead to mysql.connector.errors.ProgrammingError: Wrong number of arguments during string formatting
(2) Is only %s supported? What if I'm inserting into a column that is INTEGER? Use of %i gives the same error. Which leads to goofy things like VALUES ( %s + 0 )
Subject
Written By
Posted
Wrong number of arguments during string formatting
March 05, 2013 05:20PM
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.