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.

hstore adapter

#114

Submitted by: Adrian Klaver

Seems the register_hstore only works with connections that use cursors that return an indexed tuple. When using the RealDictConnection/Cursor I get the traceback below. It can be worked around by supplying the OID.

/home/aklaver/<ipython-input-12-b3da0e399c73> in <module>()
----> 1 psycopg2.extras.register_hstore(cur)

/usr/local/lib/python2.6/dist-packages/psycopg2-2.4.3-py2.6-linux-i686.egg/
psycopg2/extras.pyc in register_hstore(conn_or_curs, globally, unicode, oid,
array_oid)
    742     """
    743     if oid is None:
--> 744         oid = HstoreAdapter.get_oids(conn_or_curs)
    745         if oid is None or not oid[0]:
    746             raise psycopg2.ProgrammingError(

/usr/local/lib/python2.6/dist-packages/psycopg2-2.4.3-py2.6-linux-i686.egg/
psycopg2/extras.pyc in get_oids(self, conn_or_curs)
    690 """ % typarray)
    691         for oids in curs:
--> 692             rv0.append(oids[0])
    693             rv1.append(oids[1])
    694

Reported by Psycopg website · June 27th, 2012 @ 04:42 PM

State: resolved
Milestone: none
Assigned to: nobody

Activity

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

    Yes, several psycopg parts don't work correctly with RealDict cursors, because they are not dbapi-compatible. Supplying the OID is the designed workaround.

    OTOH, one of the changes recently committed in devel allows any non-base connection to create cursor of different classes: I think it should be easy to make these cursor internal usage more robust specifying the base cursor as cursor_factory.

    June 27th, 2012 @ 05:35 PM

  2. Adrian Klaver
    Adrian Klaver

    In the meantime would it be possible to change the documentation to make this plain.

    June 27th, 2012 @ 08:09 PM

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

    Fixed in my devel. Thank you for the report.

    August 14th, 2012 @ 10:30 PM