修改数据库8小时未使用,连接关闭的问题
This commit is contained in:
parent
973e88a5ef
commit
8c145a512a
|
@ -16,7 +16,7 @@ class SqlalchemyConnect:
|
|||
|
||||
def init_engine(self):
|
||||
engine = create_engine(
|
||||
f"mysql+pymysql://{self.user}:{self.password}@{self.host}/{self.db}?charset=utf8mb4")
|
||||
f"mysql+pymysql://{self.user}:{self.password}@{self.host}/{self.db}?charset=utf8mb4",pool_recycle=3600*4)
|
||||
return engine
|
||||
|
||||
def get_db(self) -> sessionmaker:
|
||||
|
|
Loading…
Reference in New Issue