def load_sqlite(self, db, query=None, table=None, cls=None,
                    column_map=None):
        """Load data from sqlite db and return as list of specified objects."""
        if column_map is None:
            column_map = {}
        db_path = self.profile_path(db, must_exist=True)

        def obj_factory(cursor, row):
            dict_ = {}
            for idx, col in enumerate(cursor.description):
                new_name = column_map.get(col[0], col[0])
                dict_[new_name] = row[idx]
            return cls(**dict_)

        con = sqlite3.connect(str(db_path))
        con.row_factory = obj_factory
        cursor = con.cursor()
        if not query:
            columns = [f.name for f in attr.fields(cls)]
            for k, v in column_map.items():
                columns[columns.index(v)] = k
            query = 'SELECT %s FROM %s' % (','.join(columns), table)
        cursor.execute(query)
        while True:
            item = cursor.fetchone()
            if item is None:
                break
            yield item
        con.close()
Load data from sqlite db and return as list of specified objects.