ProgrammingError: can't adapt (None)

Hartmut Goebel <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization Goebel Consult
Message-ID <[email protected]>
Hi,

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?

-- 
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP

Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
smime.p7s (application/x-pkcs7-signature, 4.6 KB) - not displayed
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.