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.

Missing cursor.isready and cursor.fileno in 2.3.0

#19

Submitted by: Paul Reznicek

Hello,
There are no more isready and fileno in cursor, so that using select to wait for notify make problems. Fileno can be used from connection, but without isready the waiting for notification is difficult.

Reported by Psycopg website · November 25th, 2010 @ 11:41 AM

State: invalid
Milestone: none
Assigned to: nobody

Activity

  1. Daniele Varrazzo
    Daniele Varrazzo
    • State changed from new to invalid

    Hello,

    isready() was dropped in the async overhaul performed in psycopg 2.2 release.

    fileno() was moved from the cursor to the connection, as it is the connection to wrap the socket. You can access it using cur.connection.fileno().

    Listening for notify whould be easier than it was before 2.2: use connection.poll() and check if there is anything new in notifies. More efficient than continuous polling, you can use conn.fileno() in a wait facility such as select() and only poll when there is something to read. There is no more need for isready(): poll() cares about it. The doc contains examples about how to use the interface.

    It should be easy to adapt the code to the new interface. If it proves hard, please send a snippet with your previous listening loop and we may be able to help you (see the lighthouse help if you want to post code well formatted).

    November 25th, 2010 @ 12:08 PM