Re: copy_from and rowcount

From: Federico Di Gregorio <fog(at)dndg(dot)it>
To: psycopg(at)postgresql(dot)org
Cc: rpkelly22(at)gmail(dot)com
Subject: Re: copy_from and rowcount
Date: 2013-09-20 14:04:19
Message-ID: 523C55E3.3010101@dndg.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On 12/09/2013 18:06, Ryan Kelly wrote:
> I'm wondering if it's possible to get the number of rows copied when
> using copy_from? I would've thought the .rowcount attribute of the cursor
> would have this value, but that doesn't seem to be the case.

Sorry for the late asnwer.

If I remember correctly the libpq docs don't say if it is possible to
retrieve the number of inserted columns and we're not sending data
line-by-line but as chunks so counting the lines isn't possible. Maybe
(a big maybe) the final PGresult contains that but I can't find this
documented anywhere. We'll need to instrument psycopg to print PGresult
fields and do a bit of guesswork.

federico

--
Federico Di Gregorio federico(dot)digregorio(at)dndg(dot)it
Di Nunzio & Di Gregorio srl http://dndg.it
Those who do not study Lisp are doomed to reimplement it. Poorly.
-- from Karl M. Hegbloom .signature

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message David Blewett 2013-09-20 19:08:49 Re: copy_from and rowcount
Previous Message Ryan Kelly 2013-09-12 16:06:34 copy_from and rowcount