Adding pessimistic sqlalchemy disconnection handling
This commit is contained in:
@ -3,7 +3,15 @@
|
||||
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
|
||||
:license: Apache, see LICENSE for more details.
|
||||
"""
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_sqlalchemy import SQLAlchemy as SA
|
||||
|
||||
|
||||
class SQLAlchemy(SA):
|
||||
def apply_pool_defaults(self, app, options):
|
||||
SA.apply_pool_defaults(self, app, options)
|
||||
options["pool_pre_ping"] = True
|
||||
|
||||
|
||||
db = SQLAlchemy()
|
||||
|
||||
from flask_migrate import Migrate
|
||||
|
Reference in New Issue
Block a user