Closed Bug 1213334 Opened 10 years ago Closed 10 years ago

Sequencer for cursor.fetchall() that automatically makes lists of dicts

Categories

(Socorro :: General, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: peterbe, Assigned: peterbe)

Details

Attachments

(1 file)

It's DRY violation to have to do this:: sql = "select col1, col2 from table" results = self.query(sql) things = [] for each in results: things.append(dict(zip(('col1','col2'), each)) This is especially prevalent when the list is much longer than just col1 and col2 as per the example above.
Assignee: nobody → peterbe
Commits pushed to master at https://github.com/mozilla/socorro https://github.com/mozilla/socorro/commit/1250a94ccc1dcbbc674c8b9748d53655ece8d3bf fixes bug 1213334 - sequence for cursor.fetchall(), r=twobraids https://github.com/mozilla/socorro/commit/ffd43518deb4a6e30ac21a656f671870690a2c98 Merge pull request #3030 from peterbe/bug-1213334-sequence-for-cursorfetchall fixes bug 1213334 - sequence for cursor.fetchall()
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: