

def import_data(self, user, upload, external_id_field_index=None):
    '\n        Import data into this ``Dataset`` from a given ``DataUpload``.\n        '
    self.lock()
    try:
        if upload.imported:
            raise DataImportError(_('This file has already been imported.'))
        task_type = get_import_task_type_for_upload(upload)
        if (not task_type):
            raise DataImportError(_('This file type is not supported for data import.'))
        if task_type.column_schema:
            if (upload.columns != [c['name'] for c in self.column_schema]):
                raise DataImportError(_('The columns in this file do not match those in the dataset.'))
        else:
            self.column_schema = make_column_schema(upload.columns, types=upload.guessed_types)
        if (self.sample_data is None):
            self.sample_data = upload.sample_data
        if ((self.initial_upload is None) and (self.row_count is None)):
            self.initial_upload = upload
        self.current_task = TaskStatus.objects.create(task_name=task_type.name, task_description=(_('Import data from %(filename)s into %(slug)s.') % {
            'filename': upload.filename,
            'slug': self.slug,
        }), creator=user)
        self.save()
        task_type.apply_async(args=[self.slug, upload.id], kwargs={
            'external_id_field_index': external_id_field_index,
        }, task_id=self.current_task.id)
    except:
        self.unlock()
        raise

dataset/ETHPy150Open pandaproject/panda/panda/models/dataset.py Dataset.import_data/VarMisuse@73/155 `self`->`task_type`