pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
listen/notify with python pgdb
2+ messages / 2 participants
[nested] [flat]

* listen/notify with python pgdb
@ 2003-03-11 17:16 george young <gry@ll.mit.edu>
  2003-03-12 05:28 ` Re: listen/notify with python pgdb Horst Herb <subscriptions@gnumed.net>
  0 siblings, 1 reply; 2+ messages in thread

From: george young @ 2003-03-11 17:16 UTC (permalink / raw)
  To: pgsql-interfaces

[postgresql 7.3, python 2.3a1, pygresql-3.4-pre021201]
Does anyone use listen/notify with pgdb, the python DB-API
interface?  I've done a crude hack, but maybe someone has a nicer one?
{Yes, I know notify is not part of the python DB-API: I'm trying
to stay as close to portable API's and still get the work done...}

Here's what I'm doing:
#pgdb_extended.py
'''This is a small wrapper module for pgdb, the Python DB-SIG 2.0
compliant implentation for postgresql access from python.
This wrapper adds just one member function, viz. 'pgdbCnx.getnotify()'.
getnotify just calls the postgresql libpq C API function getnotify() to
get notify messages resulting corresponding to sql 'listen' commands that
have been made.'''

from pgdb import *

def getnotify(self):
        return self._pgdbCnx__cnx.getnotify()

pgdbCnx.getnotify = getnotify


-- George


-- 
 I cannot think why the whole bed of the ocean is
 not one solid mass of oysters, so prolific they seem. Ah,
 I am wandering! Strange how the brain controls the brain!
	-- Sherlock Holmes in "The Dying Detective"



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

* Re: listen/notify with python pgdb
  2003-03-11 17:16 listen/notify with python pgdb george young <gry@ll.mit.edu>
@ 2003-03-12 05:28 ` Horst Herb <subscriptions@gnumed.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Horst Herb @ 2003-03-12 05:28 UTC (permalink / raw)
  To: pgsql-interfaces

george young wrote:
> [postgresql 7.3, python 2.3a1, pygresql-3.4-pre021201]
> Does anyone use listen/notify with pgdb, the python DB-API
> interface?  I've done a crude hack, but maybe someone has a nicer one?

we are doing it quite extensively in our "gnumed" project, and it works 
to our satisfaction.

We run the "listener" in a background thread which then posts messages 
on receiving backend notifications.

However, we are using the pyPgSql python adapter, not the pgdb one.
Have a look at 
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/gnumed/gnumed/gnumed/client/python-common/gmBacke...

Horst





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


end of thread, other threads:[~2003-03-12 05:28 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-03-11 17:16 listen/notify with python pgdb george young <gry@ll.mit.edu>
2003-03-12 05:28 ` Horst Herb <subscriptions@gnumed.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