This project is archived and is in readonly mode.

#3 ✓resolved
Daniele Varrazzo

Support notifications payload

Reported by Daniele Varrazzo | November 2nd, 2010 @ 12:00 AM | in release-2.3.0

Add support for the notification payload available in PG 9.0

Under development in piro's notify-payload branch.

Comments and changes to this ticket

  • Kevin

    Kevin November 6th, 2010 @ 12:43 AM

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

  • Daniele Varrazzo

    Daniele Varrazzo November 6th, 2010 @ 12:57 AM

    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.

  • Daniele Varrazzo

    Daniele Varrazzo November 6th, 2010 @ 04:30 PM

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

  • Kevin

    Kevin November 6th, 2010 @ 05:10 PM

    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.

  • Daniele Varrazzo

    Daniele Varrazzo November 6th, 2010 @ 06:37 PM

    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...

  • Daniele Varrazzo

    Daniele Varrazzo December 1st, 2010 @ 11:30 PM

    • State changed from “open” to “resolved”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="https://github.com/psycopg/psycopg2/issues">the new tracker</a>.
<br/>
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

People watching this ticket

Tags

Referenced by

Pages