On Thu, Jun 16, 2011 at 7:03 AM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote:
> Okay, let me put it another way. > > Are there any plans to give developers an easy way to retrieve values from > a cursor.fetchall(), in a DictCursor style? > > Default: ((Decimal('0'), Decimal('52'), Decimal('4159'), 9998L),) > > What I'm looking for: > [{ > 'f1' : Decimal('0'), > 'f2' : Decimal('52'), > 'f3' : Decimal('4159'), > 'f4' : 9998L > }] > > Maybe something like cursor.fetchall(field_names=True), or > cursor.dictfetchall() - which is what the removed function did. > > Cal > > On Thu, Jun 16, 2011 at 2:54 PM, Luke Plant <l.plant...@cantab.net> wrote: > >> On 16/06/11 14:10, Cal Leeming [Simplicity Media Ltd] wrote: >> > Okay, er. >> > >> > In reference to the original problem (cursor's not default to >> > DictCursor), thus no field names are returned, is there a specific >> > reason for this? If not, I'll probably raise a ticket to have it >> > considered for change. >> >> I'm not sure exactly what you are asking, because this is about default >> behaviour. The choice of a default is usually made according to what is >> thought to be the most useful, or according to the way it happens to >> have been done in the past. >> >> I also don't know what exactly you are suggesting. Our backwards >> compatibility policy means that we aren't going to change the default, >> unless other people's code is going to work transparently (which >> wouldn't be the case here), so it doesn't really matter what the >> original reason was, if there was one. If you are suggesting that we add >> some functionality to make use of DictCursor more useful, then certainly >> the suggestion is valid. >> >> Regards, >> >> Luke >> >> -- >> The probability of someone watching you is proportional to the >> stupidity of your action. >> >> Luke Plant || http://lukeplant.me.uk/ >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django developers" group. >> To post to this group, send email to django-developers@googlegroups.com. >> To unsubscribe from this group, send email to >> django-developers+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-developers?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to django-developers@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > The field names are available in cursor.description, precisely as in a normal PEP249 compliant DB-API adapter. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.