james.pye
2/19/2008 4:54:00 PM
On Feb 19, 8:06 am, Thomas Guettler <h...@tbz-pariv.de> wrote:
> Any suggestions?
If you don't mind trying out some beta quality software, you can try
my pg_proboscis driver. It has a DBAPI2 interface, but for you to use
COPY, you'll need to use the GreenTrunk interface:
import postgresql.interface.proboscis.dbapi2 as db
# yeah, it doesn't use libpq, so you'll need to "spell" everything
out. And, no dsn either, just keywords.
src = db.connect(user = 'pgsql', host = 'localhost', port = 5432,
database = 'src')
dst = db.connect(suer = 'pgsql', host = 'localhost', port = 5432,
database = 'dst')
fromq = src.greentrunk.Query("COPY tabl TO STDOUT")
toq = dst.greentrunk.Query("COPY tabl FROM STDIN")
toq(fromq())
It's mostly pure-python, so if you don't have any indexes on the
target table, you'll probably only get about 100,000 - 150,000 records
per second(of course, it depends on how beefy your CPU is). With
indexes on a large destination table, I don't imagine the pure Python
COPY being the bottleneck.
$ easy_install pg_proboscis
Notably, it currently(version 0.9) uses the qmark paramstyle, but I
plan to make 1.0 much more psyco. =)
[python.projects.postgresql.org, some of the docs are outdated atm due
to a recent fury of development =]