Skip site navigation (1) Skip section navigation (2)

Re: Number of deleted rows in Python module

From: Gerhard Häring <gerhard(dot)haering(at)opus-gmbh(dot)net>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Number of deleted rows in Python module
Date: 2002-10-11 08:44:09
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
D'Arcy J.M. Cain <darcy(at)druid(dot)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

In response to

pgsql-interfaces by date

Next:From: Vit PruchaDate: 2002-10-11 10:37:10
Subject: Borland builder libpg or libpg++
Previous:From: victor3.lopesDate: 2002-10-11 08:34:43
Subject: Re: TR: Re: TR: interface PERL and return results

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group