pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Number of deleted rows in Python module
3+ messages / 3 participants
[nested] [flat]

* Number of deleted rows in Python module
@ 2002-10-02 12:59 Dorian Tessore <d.tessore@louise.it>
  2002-10-06 11:18 ` Re: Number of deleted rows in Python module D'Arcy J.M. Cain <darcy@druid.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Dorian Tessore @ 2002-10-02 12:59 UTC (permalink / raw)
  To: pgsql-interfaces

Hi every body,
It's the first time that I post to this list, so please excuse me if the 
question is not in the right list.


My SW: Python 1.5.2; pgsql/v7.1.3; RedHat 7.2

My question:
Is there a way of knowing how many rows have been deleted or updated when 
sending a query from a python script to pgsql.
Normally I use :
db = pg.connect( ...)
res=db.query("delete from mytable")

But now I don't know how many rows have been deleted.
(The function res.ntuples() works only for a select statement)

Can anybody help me?
Thank you
Dorian



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Number of deleted rows in Python module
  2002-10-02 12:59 Number of deleted rows in Python module Dorian Tessore <d.tessore@louise.it>
@ 2002-10-06 11:18 ` D'Arcy J.M. Cain <darcy@druid.net>
  2002-10-11 08:44   ` Re: Number of deleted rows in Python module Gerhard Häring <gerhard.haering@opus-gmbh.net>
  0 siblings, 1 reply; 3+ messages in thread

From: D'Arcy J.M. Cain @ 2002-10-06 11:18 UTC (permalink / raw)
  To: Dorian Tessore <d.tessore@louise.it>; +Cc: pgsql-interfaces

On October 2, 2002 08:59 am, Dorian Tessore wrote:
> Hi every body,
> It's the first time that I post to this list, so please excuse me if the
> question is not in the right list.
>
>
> My SW: Python 1.5.2; pgsql/v7.1.3; RedHat 7.2
>
> My question:
> Is there a way of knowing how many rows have been deleted or updated when
> sending a query from a python script to pgsql.

Not yet.  I would like to make this available using PQcmdTuples but I can 
only do so in the classic (import pg) module as I am not sure that the DB-API 
interface (import pgdb) even allows for this to be returned.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Number of deleted rows in Python module
  2002-10-02 12:59 Number of deleted rows in Python module Dorian Tessore <d.tessore@louise.it>
  2002-10-06 11:18 ` Re: Number of deleted rows in Python module D'Arcy J.M. Cain <darcy@druid.net>
@ 2002-10-11 08:44   ` Gerhard Häring <gerhard.haering@opus-gmbh.net>
  0 siblings, 0 replies; 3+ messages in thread

From: Gerhard Häring @ 2002-10-11 08:44 UTC (permalink / raw)
  To: pgsql-interfaces

D'Arcy J.M. Cain <darcy@druid.net> [2002-10-06 11:18 GMT]:
> On October 2, 2002 08:59 am, Dorian Tessore wrote:
>> Hi every body,
>> It's the first time that I post to this list, so please excuse me if the
>> question is not in the right list.
>>
>>
>> My SW: Python 1.5.2; pgsql/v7.1.3; RedHat 7.2
>>
>> My question:
>> Is there a way of knowing how many rows have been deleted or updated when
>> sending a query from a python script to pgsql.
> 
> Not yet.  I would like to make this available using PQcmdTuples but I can 
> only do so in the classic (import pg) module as I am not sure that the DB-API 
> interface (import pgdb) even allows for this to be returned.

You can return it as return value of cursor.execute. Normally this method
doesn't return anything, but IMO it's safe to return the number of changed rows
there, and some DB-API modules do so. I plan to introduce this feature in
pyPgSQL, too.

-- Gerhard





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-10-11 08:44 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-10-02 12:59 Number of deleted rows in Python module Dorian Tessore <d.tessore@louise.it>
2002-10-06 11:18 ` D'Arcy J.M. Cain <darcy@druid.net>
2002-10-11 08:44   ` Gerhard Häring <gerhard.haering@opus-gmbh.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox