problems with mysql db
gagsl-py2 at yahoo.com.ar
Mon Jun 29 10:59:59 EDT 2009
En Mon, 29 Jun 2009 10:32:40 -0300, Petr Messner <petr.messner at gmail.com>
> use %s instead of %d in SQL statements, because (AFAIK) conversions
> (including SQL escaping) from Python values to SQL values are done
> before the % operator is called - that value is not a number by that
> I hope you understood it, sorry for my English :-) You can also check
> MySQLdb module source, it's pretty clear.
It's best to think of %s as just a marker; other adapters use ? or :3 for
the same purpose, and other styles exist too.
The fact that it's the same character used for formatting strings with the
% operator is an unfortunate coincidence (or a very bad choice, I don't
More information about the Python-list