python and mysqldb
Robert Kasunic
robert at kasunic.de
Wed Mar 21 10:50:14 EST 2001
Hello,
I would like to process a file and store different things from that file
into a MySQL DB. The code stated below works as expected, but if I try to
substitute one of those values with a variable I get the following Error:
_mysql.OperationalError: (1054, "Unknown column 'temp' in 'field list'")
^^^^
temp is the name of the variable
db = MySQLdb.connect(db='test',user='test',passwd='***secret***')
cursor = db.cursor()
statement = "INSERT INTO test_table VALUES ('test1', 'test2', 'test3')"
cursor.execute(statement)
I am quite sure that I have to change the syntax somehow, but couldn't
find anything useful on the web. Can somebody enlighten me?
Cheers
Robert
More information about the Python-list
mailing list