From: | Victor Hooi <victorhooi(at)yahoo(dot)com> |
---|---|
To: | psycopg(at)postgresql(dot)org |
Subject: | Passing Parameters to copy_expert()? |
Date: | 2013-11-08 08:22:48 |
Message-ID: | CAMnnoU+BdJqgrhJQXFRmTPMbn3tk2WeGQmL60HdcB6zjOrOp4Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
Hi,
I'm trying to use the copy_expert() command to dump records from a database
to CSV.
http://initd.org/psycopg/docs/cursor.html#cursor.copy_expert
However, I need to pass some parameters into the SQL statement - namely the
values for a WHERE IN clause.
(Basically, the COPY operation is too big for our PostgreSQL server to
handle, so we're chunking it up into multiple queries - hence, needing to
pass in values to WHERE IN).
I can't seem to see anything in the docs about this about how to pass
parameters through to copy.
I could use Python's own string interpolation, however, I'm under the
impression that's a pretty bad thing.
Is there another way to pass parameters to copy_expert()?
Cheers,
Victor
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2013-11-08 10:44:39 | Re: Passing Parameters to copy_expert()? |
Previous Message | Adrian Klaver | 2013-11-06 15:07:04 | Re: Best strategy for bulk inserts where some violate unique constraint? |