Re: How to make DictCursor the default cursor with psycopg2+twisted?
"Lawrence Oluyede" <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Apr 18, 2008 at 6:57 PM, Nathan <[email protected]> wrote: > In my small python scripts, I usually use DictCursors like this: > > curs = db.cursor(cursor_factory = psycopg2.extras.DictCursor) > > Now I'd like to do the same thing using Twisted, but you only pass db > connection parameters and sql query paramaters through Twisted to > psycopg, while Twisted handles everything else (including cursors) > itself. > > Is there a way to globally configure psycopg2 so that it used > psycopg2.extras.DictCursor by default? You can instantiate a DictConnection so each cursor you retrieve from it will be dict-like. See http://initd.org/svn/psycopg/psycopg2/trunk/lib/extras.py -- Lawrence, stacktrace.it - oluyede.org - neropercaso.it "It is difficult to get a man to understand something when his salary depends on not understanding it" - Upton Sinclair