Hacker News new | ask | show | jobs
by Joker_vD 645 days ago
Honestly, the "proper" way should be passing something like this

    def namedtuple_factory(cursor, row):
        fields = [column[0] for column in cursor.description]
        cls = namedtuple("Row", fields)
        return cls._make(row)
to the fetchall(), to automatically keep the names in sync with those in the SQL query string.
1 comments

Implemented as conn.row_factory = sqlite3.Row