Thanks Gabriel. You are correct - this is even documented in the MySQLdb User's Guide (http://mysql-python.sourceforge.net/MySQLdb.html), but it's certainly not intuitive, given how python string interpolation normally works.<br><br><b><i>Gabriel Genellina <gagsl-py2@yahoo.com.ar></i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> En Tue, 23 Oct 2007 20:50:55 -0300, Michael Pelz Sherman  <br><mpelzsherman@yahoo.com> escribió:<br><br>> Leif B. Kristensen wrote:<br>><br>>>>>  SQL = 'INSERT into TEMP data = %s'<br>>>>>  c.execute(SQL, """ text containing ' and ` and all other stuff we<br>>>> .  might<br>>>> .   read from the network""")<br>>><br>>>> Sure, but does this work if you need more than one placeholder?<br>><br>>> Yes it works with more than one placeholder.<br>><br>> Yes, BUT: I have found that all of the
 placeholders must be STRINGS!<br>><br>> If I try to use other data types (%d, %f, etc.), I get an error:<br>><br>> File "/usr/lib/python2.5/site-packages/MySQLdb/cursors.py", line 149, in  <br>> execute<br>>     query = query % db.literal(args)<br>> TypeError: float argument required<br>><br>> It's not a huge problem to convert my non-string args, but it<br>> seems like this should be fixed if it's a bug, no?<br><br>No. The *MARK* is always %s - but the data may be any type (suitable for  <br>the database column, of course).<br>The only purpose of %s is to say "insert parameter here". Other adapters  <br>use a question mark ? as a parameter placeholder, a lot less confusing, as  <br>it does not look like string interpolation.<br><br>-- <br>Gabriel Genellina<br><br>-- <br>http://mail.python.org/mailman/listinfo/python-list<br></mpelzsherman@yahoo.com></blockquote><br>