Avoiding “MySQL server has gone away” on infrequently used Python / Flask server with SQLAlchemy

后端 未结 7 919
别跟我提以往
别跟我提以往 2020-12-07 11:15

How can Flask / SQLAlchemy be configured to create a new database connection if one is not present?

I have an infrequently visited Python / Flask server which uses S

7条回答
  •  孤街浪徒
    2020-12-07 11:22

    The pessimistic approach as described by @wim

    pool_pre_ping=True

    can now be done for Flask-SQLAlchemy using a config var -->

    SQLALCHEMY_POOL_PRE_PING = True

提交回复
热议问题