@transaction.commit_manually
    def prep_and_run_importer(self, conn):
        self.cursor = conn.cursor()
        # Right now, the importer name matches the table name.
        self._setup_progressbar()
        self.insert_only = self.model.objects.all().count() == 0

        transaction.commit()

        inserts_bucket = []
        updates_bucket = []
        inserts_counter = 0
        updates_counter = 0
        batch_size = 1000
        self.itercount = 0
        query_string = 'SELECT * FROM %s' % self.table_name

        try:
            for new_obj, insert in (self.import_row(row) for row in self.cursor.execute(query_string)):
                # Now we have either a new model instance, an existing model
                # instance with updated fields or None == skip
                if new_obj:
                    if insert:
                        inserts_bucket.append(new_obj)
                        inserts_counter += 1
                        if inserts_counter % batch_size == 0:
                            insert_many(inserts_bucket)
                            inserts_bucket = []
                    else:
                        updates_bucket.append(new_obj)
                        updates_counter += 1
                        if updates_counter % batch_size == 0:
                            update_many(updates_bucket)
                            updates_bucket = []

                if self.itercount % self.progress_update_interval == 0:
                    self._progress_handler()

                self.itercount += 1

    #                if settings.DEBUG:
    #                    db.reset_queries()
            if len(inserts_bucket) > 0:
                insert_many(inserts_bucket)
            if len(updates_bucket) > 0:
                update_many(updates_bucket)
        except Exception:
            transaction.rollback()
            raise
        else:
            transaction.commit()
        # Progressbar to 100%.
        self.pbar.finish()
        # Clean up the cursor, free the memory.
        self.cursor.close()
Prepares the SQLite objects, progress bars, and other things and
dataset/ETHPy150Open gtaylor/django-eve-db/eve_db/ccp_importer/importers/importer_classes.py/SQLImporter.prep_and_run_importer