Re: copy_from() with a list of columns?

Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization initd.org
Message-ID <1254343333.7039.6.camel@mila>
Il giorno mer, 30/09/2009 alle 22.29 +0200, Stephane Bortzmeyer ha
scritto:
> On Wed, Sep 30, 2009 at 10:21:21PM +0200,
>  Stephane Bortzmeyer <[email protected]> wrote 
>  a message of 16 lines which said:
> 
> > But psycopg's copy_from seems to have no way to specify the columns
> > you use.
> 
> OK, it is apparently not in the doc but I've found it in the sources:
> 
> cursor.copy_from(input, "MyTable", columns=['foobar'])

Yep, that's it. And for special tasks you can even use copy_expert().

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                [email protected]
INIT.D Developer                                           fog-NGVKUo/i/[email protected]
               Nice to meet you Rose... run for your life. -- The Doctor

_______________________________________________
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)

iEYEABECAAYFAkrDwqUACgkQvcCgrgZGjeuKCgCfUJPaZHKjhU88X2ZXx7LeCFE0
IngAniVM5JQXiUPSBzFspVNezWKoo4sq
=C/78
-----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.