Re: ProgrammingError: can't adapt (None)
Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Organization | initd.org |
| Message-ID | <[email protected]> |
Il giorno ven, 06/03/2009 alle 18.32 +0100, Hartmut Goebel ha scritto: > I'm experiencing another problem: When filling a table with data, I > get > an "ProgrammingError: can't adapt" when using this code segment: > > ...8<---- snip --- > sql = 'INSERT INTO MyTable VALUES %s' > for row in rows: > ... > row = tuple(row) > curs.execute(sql, (row,) ) ## ProgrammingError here > ...8<---- snap --- > > Since tuples are handled by the handles set up in psycopg2.extensions, > I've put in these lines to track down the problem: > > for o in row: > print o > print psycopg2.extensions.adapt(o) > > This fails with: > > None > Traceback (most recent call last): > ... > print psycopg2.extensions.adapt(o) > psycopg2.ProgrammingError: can't adapt > > What is wrong here? Shouldn't all tuple values be converted into > SQL-Syntax? Yes but they are converted to array not to something that can be used in an insert. Anyway, "can't adapt" is an error. What's the content of the row? -- Federico Di Gregorio http://people.initd.org/fog Debian GNU/Linux Developer [email protected] INIT.D Developer fog-NGVKUo/i/[email protected] Those who do not study Lisp are doomed to reimplement it. Poorly. -- from Karl M. Hegbloom .signature _______________________________________________ Psycopg mailing list Psycopg-IAPFreCvJWPBWskQ1e/[email protected] http://lists.initd.org/mailman/listinfo/psycopg
signature.asc
(application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEABECAAYFAkm00u0ACgkQvcCgrgZGjevsiACfTYRg3RSwZ6RyQ/B4hC222a6T njsAoLCQWlnZj0Y3xkP7fJIleFWmWpzx =sb3E -----END PGP SIGNATURE-----