[Tutor] Understanding DBAPI cursor.execute (original) (raw)

John Fabiani jfabiani at yolo.com
Sat Jul 31 19:07:19 CEST 2004


I'm using MySQLdb (but I'd like to use others DB too) and I'm trying to understand the DBAPI cursor.execute. when I use cursor.execute("SELECT * FROM mytest where address = %s",string1) above works but   cursor.execute("SELECT * FROM mytest where address = %s" % string1) above does not work. So why did   cursor.execute("SELECT * FROM mytest where clientID = %d" % numb) work? clientID,address was created using clientID int not null auto_increment primary key address varchar(40)

Can someone explain why the difference and does the same thing work with other DBAPI drivers?

Thanks for the help - someday soon I hope I'll be able to help. John



More information about the Tutor mailing list