Spaces:
Runtime error
Runtime error
| from sqlalchemy import ( | |
| Boolean, | |
| ForeignKey, | |
| Integer, | |
| String, | |
| ) | |
| from sqlalchemy.orm import Mapped, relationship, mapped_column | |
| from components.dbo.models.base import Base | |
| class Dataset(Base): | |
| """ | |
| Сущность, которая хранит информацию о датасете. | |
| """ | |
| __tablename__ = "dataset" | |
| name: Mapped[str] = mapped_column(String, unique=True) | |
| is_draft: Mapped[bool] = mapped_column(Boolean, default=True) | |
| is_active: Mapped[bool] = mapped_column(Boolean, default=True) | |
| previous_dataset_id: Mapped[int] = mapped_column(Integer, ForeignKey("dataset.id"), nullable=True) | |
| documents: Mapped[list["DatasetDocument"]] = relationship( | |
| "DatasetDocument", back_populates="dataset", | |
| cascade="all, delete-orphan" | |
| ) | |
| entities: Mapped[list["EntityModel"]] = relationship( | |
| "EntityModel", back_populates="dataset", | |
| cascade="all, delete-orphan" | |
| ) | |