Using the MySQLdb module
Gerhard Häring
gh at ghaering.de
Wed Apr 23 16:58:20 EDT 2003
Michael Mayhew wrote:
> Greetings,
>
> I am trying to use the MySQLdb module on a simple database local to
> my personal Linux machine. However, I keep running into trouble [...]
>
> sql = "insert into refFlatHum values ( %s, %s, %d, %d )" % ('atr',
> 'chr1', 90810, 92190)
>
> c.execute(sql)
Let the DB-API interface quote the values for you:
c.execute("insert into refFlatHum values ( %s, %s, %d, %d )",
('atr', 'chr1', 90810, 92190))
Also see the DB-API 2 specification and the documentation and examples
included in the MySQLdb source distribution.
-- Gerhard
More information about the Python-list
mailing list