blob: e436ffc6c80225f0db5e0286bb502197b441d6d9 [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001import sqlite3
2
3def dict_factory(cursor, row):
4 d = {}
5 for idx, col in enumerate(cursor.description):
6 d[col[0]] = row[idx]
7 return d
8
9con = sqlite3.connect(":memory:")
10con.row_factory = dict_factory
11cur = con.cursor()
12cur.execute("select 1 as a")
13print(cur.fetchone()["a"])