from sqlalchemy import Column, Integer, String, DateTime, ForeignKey from sqlalchemy.orm import relationship from db.base import Base class MaintenanceJob(Base): Id = Column(Integer, primary_key=True, index=True) # a list of weak entities of class CarPart CarParts = relationship("CarPart", back_populates="parent") CreatedBy = relationship("MaintenancePerson", back_populates="maintenanceJobs") Description = Column(String, nullable=False) Date = Column(DateTime, nullable=False) MaintenanceWorker = Column(ForeignKey("user.Id"), nullable=False)