MySQL Forums
Forum List  »  Connector/Python

Code not working
Posted by: Ashwin Thapar
Date: June 05, 2006 10:42AM

I am trying to run this basic mySQL code but it just does not seem to work.
The table is successfully created but the record is not added.
The same command when typed from the mysql prompt seems to work fine.
Any ideas?

cursor = conn.cursor()
cursor.execute ("DROP TABLE IF EXISTS blenders")
cursor.execute ("""
CREATE TABLE blenders(
productID CHAR,
reviewerID CHAR,
date CHAR,
reviewtype CHAR,
filename CHAR,
productrating CHAR,
easeofuse CHAR,
easeofcleaning CHAR,
durability CHAR,
style CHAR,
pros CHAR,
cons CHAR,
contents CHAR)
INSERT INTO blenders (productID, reviewerID)
VALUES ('test', 'test')
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])

Options: ReplyQuote

Written By
Code not working
June 05, 2006 10:42AM
July 28, 2006 03:41AM
July 29, 2006 09:48PM
July 30, 2006 02:25PM
August 29, 2006 02:09PM

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.