初始化前后端学生管理系统项目
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from sqlalchemy import Column, Integer,ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy_fastapi_demo_1.database import Base
|
||||
|
||||
|
||||
# 成绩表表模型
|
||||
class Score(Base):
|
||||
__tablename__ = 'score'
|
||||
# 联合主键stu_id,exam_order
|
||||
# 外键关联student
|
||||
stu_id=Column(Integer,ForeignKey('student.stu_id'),primary_key=True)
|
||||
# 声明关联student
|
||||
student=relationship('Student',back_populates='score')
|
||||
exam_id=Column(Integer,primary_key=True)
|
||||
score=Column(Integer,nullable=False)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user