Re: row_factory and DictCursor

Joel Nothman <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
I've implemented the initial change, which passes the constructor of the
row_factory a tuple of data, instead of setting each element in the
constructed object. One can still do identically:
import psycopg2
from psycopg2.extras import DictConnection, RealDictConnection
params = 'dbname=cmcrc user=cmcrc password=cmcrc'
conn = DictConnection(params) # or RealDictConnection
curs = conn.cursor()
curs.execute('SELECT * FROM my_table LIMIT 1')
row = curs.fetchone()
row[my_field]

Note the attached diff applies to after my last patch has been applied.
I'll go on to look at ways of simplifying extras.py, while retaining as much
backwards-compatibility as possible.
- Joel

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.