import sqlalchemyfrom sqlalchemy import create_enginefrom sqlalchemy.ext.declarative import declarative_basefrom sqlalchemy import Column, Integer, String,DATE,Table,ForeignKey,FLOATfrom sqlalchemy.orm import relationshipengine = create_engine("mysql+pymysql://root:12@10.30.208.36/learn",encoding='utf-8', echo=True)Base = declarative_base()stu_m2m_class = Table('stu_m2m_class', Base.metadata, Column('stu_id',Integer,ForeignKey('student.stu_id')), Column('class_id',Integer,ForeignKey('class.class_id')), )class Stundent(Base): __tablename__ = 'student' stu_id = Column(Integer, primary_key=True) name = Column(String(32), nullable=False) qq = Column(Integer)class Class(Base): __tablename__ = 'class' class_id = Column(Integer, primary_key=True) programe = Column(String(32), nullable=False) lesson_record = Column(String(32)) day = Column(DATE)class Score(Base): __tablename__ = 'score' id = Column(Integer, primary_key=True) stu_id = Column(Integer, ForeignKey("student.stu_id")) class_id = Column(Integer, ForeignKey("class.class_id")) class_day = Column(Integer, ForeignKey("class.day")) score = Column(FLOAT) fk_stu_id = relationship("Stundent", foreign_keys=[stu_id]) fk_class_id = relationship("Class", foreign_keys=[class_id]) fk_class_day = relationship("Class", foreign_keys=[class_day])Base.metadata.create_all(engine)