更新 model/sc_model.py
This commit is contained in:
@@ -1,45 +1,45 @@
|
|||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from sqlalchemy.orm import declarative_base,sessionmaker
|
from sqlalchemy.orm import declarative_base,sessionmaker
|
||||||
db_url='mysql+pymysql://root:123456@127.0.0.1:3306/ai0824?charset=utf8'
|
db_url='mysql+pymysql://root:123456@127.0.0.1:3306/ai0824?charset=utf8'
|
||||||
engine=create_engine(db_url , pool_size=50,echo=True)
|
engine=create_engine(db_url , pool_size=50,echo=True)
|
||||||
Base=declarative_base()
|
Base=declarative_base()
|
||||||
class Scores(Base):
|
class Scores(Base):
|
||||||
__tablename__ = 's_scores'
|
__tablename__ = 's_scores'
|
||||||
id=Column( Integer
|
id=Column( Integer
|
||||||
, primary_key=True
|
, primary_key=True
|
||||||
,autoincrement=True
|
,autoincrement=True
|
||||||
,comment='成绩编号'
|
,comment='成绩编号'
|
||||||
)
|
)
|
||||||
stu_id=Column(Integer
|
stu_id=Column(Integer
|
||||||
,comment='学生编号'
|
,comment='学生编号'
|
||||||
, nullable=False
|
, nullable=False
|
||||||
)
|
)
|
||||||
exam_seq=Column(Integer
|
exam_seq=Column(Integer
|
||||||
|
|
||||||
, nullable=True
|
, nullable=True
|
||||||
,comment='考试序次'
|
,comment='考试序次'
|
||||||
)
|
)
|
||||||
score=Column(Float
|
score=Column(Float
|
||||||
,comment='分数'
|
,comment='分数'
|
||||||
)
|
)
|
||||||
create_date=Column(DATETIME
|
create_date=Column(DATETIME
|
||||||
, default=datetime.now
|
, default=datetime.now
|
||||||
,comment='创建时间'
|
,comment='创建时间'
|
||||||
)
|
)
|
||||||
update_date=Column(DATETIME
|
update_date=Column(DATETIME
|
||||||
, default=datetime.now
|
, default=datetime.now
|
||||||
,onupdate=datetime.now
|
,onupdate=datetime.now
|
||||||
,comment='更新时间'
|
,comment='更新时间'
|
||||||
)
|
)
|
||||||
deleted=Column(Integer
|
deleted=Column(Integer
|
||||||
,default=1
|
,default=1
|
||||||
, comment='软删除'
|
, comment='软删除'
|
||||||
)
|
)
|
||||||
Base.metadata.create_all(engine)
|
Base.metadata.create_all(engine)
|
||||||
Session = sessionmaker( bind=engine
|
Session = sessionmaker( bind=engine
|
||||||
,autoflush=False
|
,autoflush=False
|
||||||
,autocommit = False
|
,autocommit = False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user