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

View File

@ -16,7 +16,7 @@ invoke==1.1.0
mccabe==0.6.1 # via flake8
nodeenv==1.3.2
pkginfo==1.4.2 # via twine
pre-commit==1.10.3
pre-commit==1.10.4
pycodestyle==2.3.1 # via flake8
pyflakes==1.6.0 # via flake8
pyyaml==3.13 # via aspy.yaml, pre-commit

View File

@ -15,14 +15,14 @@ asyncpool==1.0
babel==2.6.0 # via sphinx
bcrypt==3.1.4
blinker==1.4
boto3==1.7.59
botocore==1.10.59
boto3==1.7.61
botocore==1.10.61
certifi==2018.4.16
cffi==1.11.5
chardet==3.0.4
click==6.7
cloudflare==2.1.0
cryptography==2.2.2
cryptography==2.3
dnspython3==1.15.0
dnspython==1.15.0
docutils==0.14
@ -55,7 +55,7 @@ mock==2.0.0
ndg-httpsclient==0.5.0
packaging==17.1 # via sphinx
paramiko==2.4.1
pbr==4.1.0
pbr==4.1.1
pem==18.1.0
psycopg2==2.7.5
pyasn1-modules==0.2.2

View File

@ -8,9 +8,9 @@ asn1crypto==0.24.0 # via cryptography
atomicwrites==1.1.5 # via pytest
attrs==18.1.0 # via pytest
aws-xray-sdk==0.95 # via moto
boto3==1.7.61 # via moto
boto3==1.7.62 # via moto
boto==2.49.0 # via moto
botocore==1.10.61 # via boto3, moto, s3transfer
botocore==1.10.62 # via boto3, moto, s3transfer
certifi==2018.4.16 # via requests
cffi==1.11.5 # via cryptography
chardet==3.0.4 # via requests
@ -48,7 +48,7 @@ pytest==3.6.3
python-dateutil==2.6.1 # via botocore, faker, freezegun, moto
pytz==2018.5 # via moto
pyyaml==3.13 # via pyaml
requests-mock==1.5.0
requests-mock==1.5.2
requests==2.19.1 # via aws-xray-sdk, docker, moto, requests-mock, responses
responses==0.9.0 # via moto
s3transfer==0.1.13 # via boto3

View File

@ -13,8 +13,8 @@ asn1crypto==0.24.0 # via cryptography
asyncpool==1.0
bcrypt==3.1.4 # via flask-bcrypt, paramiko
blinker==1.4 # via flask-mail, flask-principal, raven
boto3==1.7.61
botocore==1.10.61 # via boto3, s3transfer
boto3==1.7.62
botocore==1.10.62 # via boto3, s3transfer
certifi==2018.4.16
cffi==1.11.5 # via bcrypt, cryptography, pynacl
chardet==3.0.4 # via requests
@ -49,7 +49,7 @@ markupsafe==1.0 # via jinja2, mako
marshmallow-sqlalchemy==0.14.0
marshmallow==2.15.3
mock==2.0.0 # via acme
ndg-httpsclient==0.5.0
ndg-httpsclient==0.5.1
paramiko==2.4.1
pbr==4.1.1 # via mock
pem==18.1.0