how to mysqldb dict cursors

Vaibhav.bhawsar bhawsar.vaibhav at gmail.com
Fri Apr 25 08:58:53 CEST 2008


Great both methods worked! I dont quite understand this since i imported the
whole module with "import MySQLdb"

Thanks!

On Fri, Apr 25, 2008 at 12:45 AM, Paul McNett <p at ulmcnett.com> wrote:

> Vaibhav.bhawsar wrote:
>
>> I have been trying to get the DictCursor working with mysqldb module but
>> can't seem to. I have pasted the basic connection code and the traceback
>> from pydev. The connection does open with the default cursor class. can't
>> figure this one out. many thanks.
>>
>
> Try one of:
>
> """
> import MySQLdb, MySQLdb.cursors
> conn = MySQLdb.connect(..., cursorclass=MySQLdb.cursors.DictCursor)
> """
>
> -or-
>
> """
> import MySQLdb, MySQLdb.cursors
> conn = MySQLdb.connect(...)
> cur = MySQLdb.cursors.DictCursor(conn)
> """
>
> I'm going off of memory here, though, but I'm at least close.
>
> Paul
>
>


-- 
Vaibhav Bhawsar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080425/fc4f3465/attachment.html>


More information about the Python-list mailing list