from sqlalchemy import Column, Integer, String, ForeignKey, LargeBinary from sqlalchemy.orm import relationship from db.base import Base class CarPart(Base): Id = Column(Integer, primary_key=True, index=True) # a list of weak entities of class CarPart ParentId = Column(Integer, ForeignKey("maintenancejob.Id"), nullable=False) parent = relationship("MaintenanceJob", back_populates="CarParts") Name = Column(String, nullable=False) Number = Column(String, nullable=False) Condition = Column(String, nullable=False) ImageURL = Column(LargeBinary, nullable=False) Cost = Column(Integer, nullable=False)