Convert string to command..
Carsten Haese
carsten at uniqsys.com
Thu Oct 18 14:17:29 EDT 2007
On Thu, 2007-10-18 at 19:53 +0200, Hrvoje Niksic wrote:
> Don't
> forget to also use a bind variable, something like:
>
> cursor.execute("INSERT INTO cache2 VALUES (?)", a)
I second the advice, but that code won't work. The bind parameters must
be a sequence, and psycopg2 (unfortunately) uses %s for parameter
markers, instead of the SQL standard question mark. So the actual code
would be
cursor.execute("INSERT INTO cache2 VALUES (%s)", (a,) )
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
More information about the Python-list
mailing list