Valid SQL?

Diez B. Roggisch deets at nospam.web.de
Tue May 23 07:36:10 EDT 2006


Harlin Seritt wrote:

> I have this string that I am sending via a Cursor.execute() using
> MySQLdb:
> 
> insert into table Ping82_eb13__elearn__ihost__com (`dateTime`,
> `values`) values(
> "Fri May 12 11:39:02 2006", "1")
> 
> Does anyone see anything wrong with this SQL syntax?

How about a stacktrace? 

http://www.catb.org/~esr/faqs/smart-questions.html

And you should use the parametrized version of execute, because then the
DB-API will take care of escaping the strings properly for you. Which is
the problem here, btw: you are using "" for strings, where SQl requires ''.

Diez



More information about the Python-list mailing list