Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	| from sqlalchemy import ( | |
| ForeignKey, | |
| Integer, | |
| ) | |
| from sqlalchemy.orm import Mapped, relationship, mapped_column | |
| from components.dbo.models.base import Base | |
| class DatasetDocument(Base): | |
| """ | |
| Отношение многие ко многим между документами и датасетами. | |
| """ | |
| __tablename__ = "dataset_document" | |
| dataset_id: Mapped[int] = mapped_column( | |
| Integer, ForeignKey('dataset.id', ondelete='CASCADE'), index=True | |
| ) | |
| document_id: Mapped[int] = mapped_column( | |
| Integer, ForeignKey('document.id', ondelete='CASCADE'), index=True | |
| ) | |
| dataset: Mapped["Dataset"] = relationship("Dataset", back_populates='documents') | |
| document: Mapped["Document"] = relationship("Document", back_populates='datasets') | |