Postgres COPY Command with python 2.3 pg

gry at ll.mit.edu gry at ll.mit.edu
Thu Feb 17 18:44:40 EST 2005


import pg
db = pg.DB('bind9', '192.168.192.2', 5432, None, None, 'named', None)
db.query('create temp table fffz(i int,t text)')
db.query('copy fffz from stdin')
db.putline("3\t'the'")
db.putline("4\t'rain'")
db.endcopy()
db.query('commit')

Note that multiple columns must be separated by tabs ('\t') (unless you
specify "copy mytable with delimiter ...").




More information about the Python-list mailing list