#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()
]
Note:
See TracTickets
for help on using tickets.
In 361f604: