(sqlite_connection, table_name)
return [nt(*row) for row in cursor.fetchall()]
convert an sqlite database table into a list of namedtuples
convert an sqlite database table into a list of namedtuples
convert an sqlite database table into a list of namedtuples
def get_list_from_table(sqlite_connection, table_name):
    """convert an sqlite database table into a list of namedtuples"""

    def camelize(s):  # 'aa_bb_cc_dd' --> 'AaBbCcDd'
        return "".join(word.title() for word in s.split("_"))

    cursor = sqlite_connection.execute("SELECT * FROM {}".format(table_name))
    col_names = " ".join(col_desc[0] for col_desc in cursor.description)
    nt = collections.namedtuple(camelize(table_name), col_names)
    return [nt(*row) for row in cursor.fetchall()]
def get_list_from_table ( sqlite_connection , table_name ) : def camelize ( s ) : # 'aa_bb_cc_dd' --> 'AaBbCcDd' return "" . join ( word . title ( ) for word in s . split ( "_" ) ) cursor = sqlite_connection . execute ( "SELECT * FROM {}" . format ( table_name ) ) col_names = " " . join ( col_desc [ 0 ] for col_desc in cursor . description ) nt = collections . namedtuple ( camelize ( table_name ) , col_names ) return [ nt ( * row ) for row in cursor . fetchall ( ) ]