Re: data type mismatch: "a number is required, not str"

Karsten Hilbert <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Tue, Jan 26, 2010 at 09:13:21AM -0500, Brian Jones wrote:

> So, again, I'm trying to do a simple execute(), and I'm running into
> really unexpected errors. I have, of course, tried perhaps 5 different
> ways of putting the query together by now, and the error has not
> changed.
> 
> Here's what I *currently* have in place in my code:
> 
>         sql = """INSERT INTO urls VALUES (%d, %d, %s, %s)"""

You must use 

	INSERT INTO urls VALUES (%s, %s, %s, %s)

The %s are NOT Python string substitution formatters despite
that they look exactly like them.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.