MySQL Forums
Forum List  »  Connector/Python

Python Multiline
Posted by: earlsofsandwich
Date: July 16, 2007 07:45PM

Hi,

I want to submit multiline statements using Python (eg statements seperated by semicolons) but am having trouble doing so. For instance, if I do

db = MySQLdb.connect(host="x.org", user="usr", passwd="pwd", db="db", client_flag=MySQLdb.constants.CLIENT.MULTI_STATEMENTS|MySQLdb.constants.CLIENT.MULTI_RESULTS)
cursor = db.getCursor()
cursor.execute("INSERT INTO x (foo) VALUES ('1');INSERT INTO x (foo) VALUES ('3')")

The last line will fail. Any idea how to fix this?

-YG

Options: ReplyQuote


Subject
Written By
Posted
Python Multiline
July 16, 2007 07:45PM
July 19, 2007 01:26PM
August 07, 2007 04:18AM


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.