Reconnecting MySQL on timeout

后端 未结 3 887
陌清茗
陌清茗 2020-12-31 16:04

I have a Python program which runs on background for weeks, and does database queries every once in a while. For that, I am using the ORM peewee (version 2.2.1). I am using

3条回答
  •  隐瞒了意图╮
    2020-12-31 16:16

    I have resolved this issue.

    My solution is use mysql connection pool PooledMySQLDatabase from playhouse.pool module.

    please read: https://github.com/coleifer/peewee/issues/239

    from peewee import *
    from playhouse.pool import *
    

提交回复
热议问题