source:
people/peter.buschman/backup_monitoring/dal/builtins/lookup_table.py
Last change on this file was 976, checked in by , on Dec 6, 2011 at 10:19:33 AM | |
---|---|
File size: 318 bytes |
Rev | Line | |
---|---|---|
[976] | 1 | ## |
2 | ## lookup_table - convert first two columns of an SQL query to a lookup table | |
3 | ## | |
4 | def lookup_table(curs, query): | |
5 | ||
6 | lookup = ExtendedDict() | |
7 | ||
8 | curs.execute(query) | |
9 | ||
10 | for row in curs.fetchall(): | |
11 | ||
12 | key = row[0] | |
13 | value = row[1] | |
14 | ||
15 | lookup[key] = value | |
16 | ||
17 | return lookup |
Note:
See TracBrowser
for help on using the repository browser.