Quantcast
Channel: MySQL Forums - Connector/Python
Viewing all articles
Browse latest Browse all 384

Wrong number of arguments during string formatting (no replies)

$
0
0
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 )

Viewing all articles
Browse latest Browse all 384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>