Insert data stored in the current chunk of parsing into the selected database


        Args:
             remove_data (boolean): Remove the data stored within the LibraryData object for the current chunk of
                                    processing
             db_type (str): The type of database to submit to
                            either 'sqlite', 'mysql' or 'django_mysql' [default sqlite]

def insert_data(self, remove_data=False, db_type='sqlite'):
        """Insert data stored in the current chunk of parsing into the selected database


        Args:
             remove_data (boolean): Remove the data stored within the LibraryData object for the current chunk of
                                    processing
             db_type (str): The type of database to submit to
                            either 'sqlite', 'mysql' or 'django_mysql' [default sqlite]
        """
        if self.update_source:
            # print "insert ref id"
            import msp2db
            self.c.execute(
                "INSERT INTO library_spectra_source (id, name, parsing_software) VALUES"
                " ({a}, '{b}', 'msp2db-v{c}')".format(a=self.current_id_origin, b=self.source, c=msp2db.__version__))
            self.conn.commit()

        if self.compound_info_all:
            self.compound_info_all = _make_sql_compatible(self.compound_info_all)

            cn = ', '.join(self.compound_info.keys()) + ',created_at,updated_at'

            insert_query_m(self.compound_info_all, columns=cn, conn=self.conn, table='metab_compound',
                           db_type=db_type)

        self.meta_info_all = _make_sql_compatible(self.meta_info_all)

        cn = 'id,' + ', '.join(self.meta_info.keys()) + ',library_spectra_source_id, inchikey_id'

        insert_query_m(self.meta_info_all, columns=cn, conn=self.conn, table='library_spectra_meta',
                       db_type=db_type)


        cn = "id, mz, i, other, library_spectra_meta_id"
        insert_query_m(self.spectra_all, columns=cn, conn=self.conn, table='library_spectra', db_type=db_type)
        if self.spectra_annotation_all:
            cn = "id, mz, tentative_formula, mass_error, library_spectra_meta_id"
            insert_query_m(self.spectra_annotation_all, columns=cn, conn=self.conn,
                           table='library_spectra_annotation', db_type=db_type)


        # self.conn.close()
        if remove_data:
            self.meta_info_all = []
            self.spectra_all = []
            self.spectra_annotation_all = []
            self.compound_info_all = []
            self._get_current_ids(source=False)