Re: "ProgrammingError: can't adapt" when passing arguments to cursor.execute

Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization initd.org
Message-ID <1258745795.3070.1.camel@mila>
Il giorno ven, 20/11/2009 alle 08.51 -0800, William Carithers ha scritto:
> Thanks. I was worried about exactly that problem such as trying to load a
> boolean into a column expecting a real. So I literally cut and pasted the
> values from the "load" list in the script editor into the "load" list in the
> interactive session. It worked in one case and not in the other. I'm not
> sure why there is a roundoff difference but as long as values are consistent
> about data types, I would think that it would be OK but at this point my
> confidence level is pretty low. 

Hi,

"can't adapt" has nothing to do with the destination types (the types of
the backend columns). It is a Python problem: you passed to psycopg a
type that psycopg does not know how to render into a string suitable to
be passed to the backend.

Can you please add something like:

for x in load:
	print type(x)

to your code and check every parameter type?

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                [email protected]
INIT.D Developer                                           fog-NGVKUo/i/[email protected]
 Questo autista me l'ha fatta a cotone!
                                     -- sedicenne palermitana in autobus

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

iEYEABECAAYFAksG78IACgkQvcCgrgZGjeuB2ACcCxLfc0NoogLBbFFMDhuHGpJl
IfAAn3G/ebulqHBf+hLL7YEnTUQ+5B4B
=yujE
-----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.