def register_ingest_view_export_file_name(
        self,
        metadata_entity: DirectIngestIngestFileMetadata,
        exported_path: GcsfsFilePath,
    ) -> None:
        parts = filename_parts_from_path(exported_path)
        if parts.file_type != GcsfsDirectIngestFileType.INGEST_VIEW:
            raise ValueError(f"Exported path has unexpected type {parts.file_type}")

        session = SessionFactory.for_schema_base(OperationsBase)

        try:
            metadata = dao.get_file_metadata_row(
                session, GcsfsDirectIngestFileType.INGEST_VIEW, metadata_entity.file_id
            )

            if metadata.normalized_file_name:
                raise ValueError(
                    f"Normalized file name already set to [{metadata.normalized_file_name}] for file id "
                    f"[{metadata.file_id}]"
                )

            metadata.normalized_file_name = exported_path.file_name
            session.commit()
        except Exception as e:
            session.rollback()
            raise e
        finally:
            session.close()
    def mark_ingest_view_exported(self,
                                  metadata_entity: DirectIngestIngestFileMetadata) -> None:
        session = SessionFactory.for_schema_base(OperationsBase)

        try:
            metadata = dao.get_file_metadata_row(session, GcsfsDirectIngestFileType.INGEST_VIEW,
                                                 metadata_entity.file_id)
            metadata.export_time = datetime.datetime.utcnow()
            session.commit()
        except Exception as e:
            session.rollback()
            raise e
        finally:
            session.close()