Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLAlchemy reconnect to db

I write daemon which use for DB SQLAlchemy. Database MySQL. If daemon idle long time then connection is broken and I see errors. Is it possible to make connect which cannot close while daemon is work or how to make reconnect to DB?

like image 891
Eugene Avatar asked Jan 18 '26 01:01

Eugene


1 Answers

there's a option "pool_recycle" when creating engine, see http://docs.sqlalchemy.org/en/rel_0_7/core/engines.html?highlight=pool_recycle

like image 198
Marcus Avatar answered Jan 20 '26 15:01

Marcus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!