def insert_record(
        self, record: record_schema.Record
    ) -> types_schema.RecordID:
        """See [DB.insert_record][trulens.core.database.base.DB.insert_record]."""
        if is_otel_tracing_enabled():
            raise RuntimeError("Not supported with OTel tracing enabled!")
        # TODO: thread safety

        _rec = self.orm.Record.parse(record, redact_keys=self.redact_keys)
        with self.session.begin() as session:
            if (
                session.query(self.orm.Record)
                .filter_by(record_id=record.record_id)
                .first()
            ):
                session.merge(_rec)  # update existing
            else:
                session.merge(_rec)  # add new record # .add was not thread safe

            logger.info(
                "%s added record %s", text_utils.UNICODE_CHECK, _rec.record_id
            )

            return _rec.record_id
See [DB.insert_record][trulens.core.database.base.DB.insert_record].
src/core/trulens/core/database/sqlalchemy.py