python sqlalchemy fastapi初始化数据
@app.on_event("startup")
def startup_event():
# 获取鼠标事件信息
global events_dict
db = SessionLocal()
events_dict = {event.name: event.id for event in crud.get_events(db)}
db.close()
print(events_dict)