MySQL Forums
Forum List  »  Connector/Python

Re: Question with python connector 1064 (42000): You have an error in your SQL syntax;
Posted by: Geert Vanderkelen
Date: April 24, 2013 05:11AM

Hello "John Doe",

It is not possible to pass column identifiers to the execute() method like you do.
The second argument is for data, not identifiers.

What you need to do is following (using format()):

query ="update AggGMDB set {newcol} = ifnull({col1},0)- ifnull({col2},0)".format(
newcol=NewColumn,
col1= column1,
col2= column2)
cursor.execute(query)

Cheers,
GEert

Geert Vanderkelen
Software Developer at Oracle

Options: ReplyQuote


Subject
Written By
Posted
Re: Question with python connector 1064 (42000): You have an error in your SQL syntax;
April 24, 2013 05:11AM


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.