示例#1
0
    def onKernelStart(self):
        from app.src.models.BaseModel import BaseModel

        baseModel = BaseModel()
        declarative = baseModel.getDeclarative()
        declarative.metadata.create_all(baseModel.getEngine())

        fixture_loader = FixtureLoader()
        fixture_loader.load()
示例#2
0
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from app.src.models.BaseModel import BaseModel

base = BaseModel()
Base = base.getDeclarative()


class TrainingModel(Base):
    __tablename__ = "training"

    id = Column(Integer(), primary_key=True, nullable=False)
    grade = Column(Integer(), nullable=True, default=None)

    comment = Column(String(100), nullable=True)

    trainingUrlId = Column(Integer(), ForeignKey('training_url.id'))
    trainingUrl = relationship("TrainingUrlModel", back_populates="trainings")

    date = Column(DateTime(), nullable=False)

    createdAt = Column(DateTime(), nullable=False)

    updatedAt = Column(DateTime(), nullable=False)