def row2dict(row):
    d = {}
    for column in row.__table__.columns:
        d[column.name] = str(getattr(row, column.name))

    return d


def list2dict(rows):
    res = []
    for row in rows:
        res.append(row2dict(row))
    return res