Also, it is not necessary to add trailing semicolons (;) to SQL statements.
You can, however, issue multiple statements in one query, separating them with
semicolons. Be aware that this will return multiple result sets.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With MySQLDB is it possible to update with parameters?
This is throwing a SQL error.
upd_cs_sql_cmd = \
"""
UPDATE synth_customer_synch
(
set EndpointId = %s, DeviceType = %s, ChannelNumber = %s, Status = %s,
Longitutde = %s, Latitude = %s
)
WHERE AcctID = %s and MeterID = %s
"""
in_row = main_in_cur.fetchone()
while None != in_row:
if in_row == None:
continune
while 1:
amr_in_cur.execute(amr_sql_cmd, (in_row,))
amr_row = amr_in_cur.fetchone()
if None == amr_row:
break
print(amr_row)
out_cur.execute(upd_cs_sql_cmd, (amr_row, amr_row, amr_row, amr_row, \
amr_row, amr_row, in_row, in_row, ) )
I found a missing ';' and added it. Am still getting a SQL syntax error.
The proper SQL syntax is documented here: http://dev.mysql.com/doc/refman/5.0
/en/update.html
In short, you should remove some parentheses around your "set ..." clause.
Also, it is not necessary to add trailing semicolons (;) to SQL statements.
You can, however, issue multiple statements in one query, separating them with
semicolons. Be aware that this will return multiple result sets.
Thanks for all the info and doc pointer.