班级模块

This commit is contained in:
2026-09-22 16:35:15 +08:00
parent a45d4046be
commit 3f3016d9ec
11 changed files with 417 additions and 1 deletions
+18
View File
@@ -0,0 +1,18 @@
from sqlalchemy import *
from sqlalchemy.orm import declarative_base,sessionmaker
db_url = "mysql+pymysql://root:123456@192.168.5.8:3306/student_system?charset=utf8mb4"
engine = create_engine(db_url)
Base = declarative_base()
Session = sessionmaker(bind=engine
,autoflush=False
,autocommit = False
)
def get_db():
db = Session()
try:
yield db
finally:
db.close()