def add_row(self, user, data, external_id=None):
        """
        Add (or overwrite) a row to this dataset.
        """
        self.lock()

        try:
            data_typer = DataTyper(self.column_schema)

            solr_row = utils.solr.make_data_row(self, data, external_id=external_id)
            solr_row = data_typer(solr_row, data)

            solr.add(settings.SOLR_DATA_CORE, [solr_row], commit=True)

            self.schema = data_typer.schema

            if not self.sample_data:
                self.sample_data = []
            
            if len(self.sample_data) < 5:
                self.sample_data.append(data)

            old_row_count = self.row_count
            self.row_count = self._count_rows()
            added = self.row_count - (old_row_count or 0)
            self.last_modified = now()
            self.last_modified_by = user
            self.last_modification = _('1 row %s') % ('added' if added else 'updated')
            self.save()

            return solr_row
        finally:
            self.unlock()
dataset/ETHPy150Open pandaproject/panda/panda/models/dataset.py/Dataset.add_row/original