Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25455 closed Cleanup/optimization (fixed)

optimization dictfetchall in documentation

Reported by: Artyem Klimenko Owned by: nobody
Component: Documentation Version:
Severity: Normal Keywords: dictfetchall
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

https://docs.djangoproject.com/en/1.8/topics/db/sql/

def dictfetchall(cursor):
    "Return all rows from a cursor as a dict"
    columns = [col[0] for col in cursor.description]
    return [
        dict(zip(columns, row))
        for row in cursor.fetchall()
    ]

Change History (3)

comment:1 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 361f604:

Fixed #25455 -- Optimized dictfetchall() example.

Thanks aklim007 for the suggestion.

comment:2 by Tim Graham <timograham@…>, 9 years ago

In bb90e8f:

[1.8.x] Fixed #25455 -- Optimized dictfetchall() example.

Thanks aklim007 for the suggestion.

Backport of 361f60479d1890e8144fc254d7389a67b35725e9 from master

comment:3 by Tim Graham <timograham@…>, 9 years ago

In ca2c5508:

[1.9.x] Fixed #25455 -- Optimized dictfetchall() example.

Thanks aklim007 for the suggestion.

Backport of 361f60479d1890e8144fc254d7389a67b35725e9 from master

Note: See TracTickets for help on using tickets.
Back to Top