public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jeff Ross <[email protected]>
To: [email protected]
Subject: Re: Can psycopg2 copy_expert read from an io.StringIO() buffer?
Date: Thu, 3 Nov 2022 15:44:41 -0600
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+mi_8Yf6_cRgDjSuFt7px=g7=skjrx_73Pb3qBDwEiasEKgfQ@mail.gmail.com>
References: <[email protected]>
	<CA+mi_8Yf6_cRgDjSuFt7px=g7=skjrx_73Pb3qBDwEiasEKgfQ@mail.gmail.com>

On 11/3/22 2:42 PM, Daniele Varrazzo wrote:
> 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
> 
> 

Indeed that did fix the problem!

THANKS!!!!!

Jeff





view thread (3+ messages)

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]
  Subject: Re: Can psycopg2 copy_expert read from an io.StringIO() buffer?
  In-Reply-To: <[email protected]>

* 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