Python MySQL connector, "wrong number of arg.."
Can someone help and give me a tip here? I'm using Python 2.7 and
MySQL-connector 1.0.12.
job = {'customer': u'Acme', 'period': 3.0, 'cost': 987654.543210123}
job_insert = "INSERT INTO f.job (customer, period, cost) VALUES
(%(customer)s, %(period)f, %(cost)f);"
cursor.execute(job_insert, job)
The above raises "mysql.connector.errors.ProgrammingError: Wrong number of
arguments during string formatting".
job_insert = "INSERT INTO f.job (customer, period, cost) VALUES
(%(customer)s, %(period)s, %(cost)s);"
Changing my insert statement so that all are %s inserts values to the
table. However, my floats are inserted 3 and 987654.5. Both of these
columns are float. Thanks.
No comments:
Post a Comment