On Tue, Oct 12, 2004 at 12:20:46PM -0400, Eric D Nielsen wrote:
> 
> I was hoping for a get/easy solution, but those never pan out :)

Here's a trivial Python program that handles NOTIFY events; it
couldn't get much easier:

#!/usr/local/bin/python

import psycopg
import select

conn = psycopg.connect('dbname=test')
conn.autocommit(1)

curs = conn.cursor()
curs.execute('LISTEN alert')

fd = curs.fileno()

while True:
    select.select([fd], [], [], None)
    curs.execute('SELECT 1')
    print curs.notifies()

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to