Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Support notifications payload

#3

Add support for the notification payload available in PG 9.0

Under development in piro's notify-payload branch.

Reported by Daniele Varrazzo · November 2nd, 2010 @ 12:00 AM

State: resolved
Milestone: release-2.3.0
Assigned to: Daniele Varrazzo Daniele Varrazzo

Activity

  1. Kevin
    Kevin

    Is there a way I can download this? The link for that branch is broken.

    November 6th, 2010 @ 12:43 AM

  2. Daniele Varrazzo
    Daniele Varrazzo

    Uhm, gitweb doesn't parse the %3B back into semicolons :\ Try http://tinyurl.com/35nckh5

    The branch has been rebased into my python2 branch that you can access from http://tinyurl.com/piro-psycopg2

    git url is <git://src.develer.com/users/piro/psycopg2.git> To summarize, currently you can find the feature both in the 'python2' and the 'notify-payload' branches.

    November 6th, 2010 @ 12:57 AM

  3. Daniele Varrazzo
    Daniele Varrazzo

    We have just released 2.3.0-beta1: the version includes this feature.

    November 6th, 2010 @ 04:30 PM

  4. Kevin
    Kevin

    Cool, sorry for the dumb question, it may not go here, but:

    while conn.notifies:
      print type(conn.notifies)
      noti = conn.notifies.pop()
      print "Got NOTIFY:", noti
    
      if noti[1] == "questions_audiogen":
        print "Yep ", noti[2]
    

    [root@vps python]# ./psycopg-listen.py
    Got NOTIFY: Notify(11913, 'questions_audiogen', '3')
    Yep
    Traceback (most recent call last):
    File "./psycopg-listen.py", line 24, in ?

    print "Yep ", noti[2]
    

    IndexError: index out of range

    But I can print [0] and [1] OK: Yep 11913 questions_audiogen

    Why's this?

    Also, are you guys on IRC anywhere?

    Thanks for your help.

    November 6th, 2010 @ 05:10 PM

  5. Daniele Varrazzo
    Daniele Varrazzo

    Hi,

    the example in the notify section is actually misleading. pid and channel are only accessed as [0] and [1] for backward compatibility. Take a look at the Notify doc: you can access the notify details by attributes .pid, .channel, .payload.

    I will fix the example to make this obvious. Thank you for testing!

    Sorry, no IRC for the moment...

    November 6th, 2010 @ 06:37 PM

  6. Daniele Varrazzo
    Daniele Varrazzo
    • State changed from open to resolved

    December 1st, 2010 @ 11:30 PM