[PyGreSQL] Copy support for pgdb

Christoph Zwerschke cito at online.de
Thu Sep 21 13:10:21 EDT 2006


Sean Davis wrote:
> By copy support, I mean writing rows directly to the server socket.  I can do 
> this with pg like so:
> 
> db.query('copy table from stdin')
> for row in rows:
>     db.putline(row + "\n")
> db.endcopy()

You can use the inserttable of pg's database connection for this.

> I can import and connect via pg for this, but using pgdb instead seems like it 
> might be worth it for the future.

If db is a pgdb connection, the inserttable method is available as 
db._pgdbCnx__cnx.inserttable

-- Christoph


More information about the PyGreSQL mailing list