make a new file called fakedb.py
and copy some contents from psycopg1.py from psycopg2 package
class connection(_2connection):
"""psycopg 1.1.x connection."""
def cursor(self):
"""cursor() -> new psycopg 1.1.x compatible cursor object"""
return _2connection.cursor(self, cursor_factory=psycopg2.extras.DictCursor)
def autocommit(self, on_off=1):
"""autocommit(on_off=1) -> switch autocommit on (1) or off (0)"""
if on_off > 0:
self.set_isolation_level(_ext.ISOLATION_LEVEL_AUTOCOMMIT)
else:
self.set_isolation_level(_ext.ISOLATION_LEVEL_READ_COMMITTED)
the point is to specify cursor_factory as DictCursor..
now use this file with adbapi like
adbapi.ConnectionPool("fakedb", database="test",host='localhost',\
port=9000,user='mathgl')