diff --git a/chanbans/db.py b/chanbans/db.py index 7dd2780..d34e8f5 100644 --- a/chanbans/db.py +++ b/chanbans/db.py @@ -37,6 +37,14 @@ def get_db(db_path: str = DB_PATH): ); """ ) + def dict_factory(cursor, row): + d = {} + for idx, col in enumerate(cursor.description): + d[col[0]] = row[idx] + return d + + db.row_factory = dict_factory + return db