public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniele Varrazzo <[email protected]>
To: Jeff Ross <[email protected]>
Cc: [email protected]
Subject: Re: Can psycopg2 copy_expert read from an io.StringIO() buffer?
Date: Thu, 3 Nov 2022 21:42:01 +0100
Message-ID: <CA+mi_8Yf6_cRgDjSuFt7px=g7=skjrx_73Pb3qBDwEiasEKgfQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
Hello Jeff,
On Thu, 3 Nov 2022 at 21:15, Jeff Ross <[email protected]> wrote:
> publisher_copy_cursor.copy_expert(copy_query,csv_buf,size)
> subscriber_copy_cursor.copy_expert(insert_query,csv_buf)
Yes, StringIO works ok with copy_expert(). I think you need a
csv_buf.seek(0) between these two statements: after copying data in
the file, the file pointer will be at the end.
Cheers
-- Daniele
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Can psycopg2 copy_expert read from an io.StringIO() buffer?
In-Reply-To: <CA+mi_8Yf6_cRgDjSuFt7px=g7=skjrx_73Pb3qBDwEiasEKgfQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox