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

Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On 26/01/2010 15:13, Brian Jones wrote:
>         sql = """INSERT INTO urls VALUES (%d, %d, %s, %s)"""

Don't use %d. The %s is a placeholder (think "?") and is not used to
determine the output format, so just avoid anything except %s (no %d, no
%f, etc.)

federico

-- 
Federico Di Gregorio                                       fog-NGVKUo/i/[email protected]
 There's no greys, only white that's got grubby. I'm surprised you
  don't know that. And sin, young man, is when you treat people as
  things. Including yourself.                       -- Granny Weatherwax

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 262 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktfBPIACgkQvcCgrgZGjevcCQCfZoV//Pgmwi7ls9ITubhWuLId
tdQAmgL0evCzwS/gAkh4kTTE7Io3tOu5
=+XAW
-----END PGP SIGNATURE-----
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.