This project is archived and is in readonly mode.
Reported by Psycopg website | June 27th, 2012 @ 04:42 PM
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: 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) 693 rv1.append(oids) 694
Comments and changes to this ticket
- 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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
WARNING: the informations in this tracker are archived. Please submit new tickets or comments to the new tracker.
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.