Adding pessimistic sqlalchemy disconnection handling

This commit is contained in:
Curtis Castrapel
2018-07-23 10:57:22 -07:00
parent faa1779204
commit 9b29f9f819
5 changed files with 20 additions and 12 deletions

View File

@ -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