def _dict_factory(cursor, row):
    """
    Creates a dict with row-names as keys for every query.
    """
    d = {}
    for idx, col in enumerate(cursor.description):
        d[col[0]] = row[idx]
    return d
