(sqlite_connection, table_name, key_col_name="id")
return the_dict
convert an sqlite database table into a dict of namedtuples
    useful for tables where each row has a unique primary key
convert an sqlite database table into a dict of namedtuples
    useful for tables where each row has a unique primary key
convert an sqlite database table into a dict of namedtuples useful for tables where each row has a unique primary key
def get_dict_from_table(sqlite_connection, table_name, key_col_name="id"):
    """convert an sqlite database table into a dict of namedtuples
    useful for tables where each row has a unique primary key"""
    the_list = get_list_from_table(sqlite_connection, table_name)
    the_dict = {row._asdict()[key_col_name]: row for row in the_list}
    fmt = "In {}, {} is not unique: {} {}"
    assert len(the_dict) == len(the_list), fmt.format(
        table_name, key_col_name, len(the_dict), len(the_list)
    )
    return the_dict
def get_dict_from_table ( sqlite_connection , table_name , key_col_name = "id" ) : the_list = get_list_from_table ( sqlite_connection , table_name ) the_dict = { row . _asdict ( ) [ key_col_name ] : row for row in the_list } fmt = "In {}, {} is not unique: {} {}" assert len ( the_dict ) == len ( the_list ) , fmt . format ( table_name , key_col_name , len ( the_dict ) , len ( the_list ) ) return the_dict