Adding pessimistic sqlalchemy disconnection handling
This commit is contained in:
parent
5e34287530
commit
a3e1d08ba2
|
@ -3,7 +3,15 @@
|
||||||
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
|
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
|
||||||
:license: Apache, see LICENSE for more details.
|
: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()
|
db = SQLAlchemy()
|
||||||
|
|
||||||
from flask_migrate import Migrate
|
from flask_migrate import Migrate
|
||||||
|
|
|
@ -16,7 +16,7 @@ invoke==1.1.0
|
||||||
mccabe==0.6.1 # via flake8
|
mccabe==0.6.1 # via flake8
|
||||||
nodeenv==1.3.2
|
nodeenv==1.3.2
|
||||||
pkginfo==1.4.2 # via twine
|
pkginfo==1.4.2 # via twine
|
||||||
pre-commit==1.10.3
|
pre-commit==1.10.4
|
||||||
pycodestyle==2.3.1 # via flake8
|
pycodestyle==2.3.1 # via flake8
|
||||||
pyflakes==1.6.0 # via flake8
|
pyflakes==1.6.0 # via flake8
|
||||||
pyyaml==3.13 # via aspy.yaml, pre-commit
|
pyyaml==3.13 # via aspy.yaml, pre-commit
|
||||||
|
|
|
@ -15,14 +15,14 @@ asyncpool==1.0
|
||||||
babel==2.6.0 # via sphinx
|
babel==2.6.0 # via sphinx
|
||||||
bcrypt==3.1.4
|
bcrypt==3.1.4
|
||||||
blinker==1.4
|
blinker==1.4
|
||||||
boto3==1.7.59
|
boto3==1.7.61
|
||||||
botocore==1.10.59
|
botocore==1.10.61
|
||||||
certifi==2018.4.16
|
certifi==2018.4.16
|
||||||
cffi==1.11.5
|
cffi==1.11.5
|
||||||
chardet==3.0.4
|
chardet==3.0.4
|
||||||
click==6.7
|
click==6.7
|
||||||
cloudflare==2.1.0
|
cloudflare==2.1.0
|
||||||
cryptography==2.2.2
|
cryptography==2.3
|
||||||
dnspython3==1.15.0
|
dnspython3==1.15.0
|
||||||
dnspython==1.15.0
|
dnspython==1.15.0
|
||||||
docutils==0.14
|
docutils==0.14
|
||||||
|
@ -55,7 +55,7 @@ mock==2.0.0
|
||||||
ndg-httpsclient==0.5.0
|
ndg-httpsclient==0.5.0
|
||||||
packaging==17.1 # via sphinx
|
packaging==17.1 # via sphinx
|
||||||
paramiko==2.4.1
|
paramiko==2.4.1
|
||||||
pbr==4.1.0
|
pbr==4.1.1
|
||||||
pem==18.1.0
|
pem==18.1.0
|
||||||
psycopg2==2.7.5
|
psycopg2==2.7.5
|
||||||
pyasn1-modules==0.2.2
|
pyasn1-modules==0.2.2
|
||||||
|
|
|
@ -8,9 +8,9 @@ asn1crypto==0.24.0 # via cryptography
|
||||||
atomicwrites==1.1.5 # via pytest
|
atomicwrites==1.1.5 # via pytest
|
||||||
attrs==18.1.0 # via pytest
|
attrs==18.1.0 # via pytest
|
||||||
aws-xray-sdk==0.95 # via moto
|
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
|
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
|
certifi==2018.4.16 # via requests
|
||||||
cffi==1.11.5 # via cryptography
|
cffi==1.11.5 # via cryptography
|
||||||
chardet==3.0.4 # via requests
|
chardet==3.0.4 # via requests
|
||||||
|
@ -48,7 +48,7 @@ pytest==3.6.3
|
||||||
python-dateutil==2.6.1 # via botocore, faker, freezegun, moto
|
python-dateutil==2.6.1 # via botocore, faker, freezegun, moto
|
||||||
pytz==2018.5 # via moto
|
pytz==2018.5 # via moto
|
||||||
pyyaml==3.13 # via pyaml
|
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
|
requests==2.19.1 # via aws-xray-sdk, docker, moto, requests-mock, responses
|
||||||
responses==0.9.0 # via moto
|
responses==0.9.0 # via moto
|
||||||
s3transfer==0.1.13 # via boto3
|
s3transfer==0.1.13 # via boto3
|
||||||
|
|
|
@ -13,8 +13,8 @@ asn1crypto==0.24.0 # via cryptography
|
||||||
asyncpool==1.0
|
asyncpool==1.0
|
||||||
bcrypt==3.1.4 # via flask-bcrypt, paramiko
|
bcrypt==3.1.4 # via flask-bcrypt, paramiko
|
||||||
blinker==1.4 # via flask-mail, flask-principal, raven
|
blinker==1.4 # via flask-mail, flask-principal, raven
|
||||||
boto3==1.7.61
|
boto3==1.7.62
|
||||||
botocore==1.10.61 # via boto3, s3transfer
|
botocore==1.10.62 # via boto3, s3transfer
|
||||||
certifi==2018.4.16
|
certifi==2018.4.16
|
||||||
cffi==1.11.5 # via bcrypt, cryptography, pynacl
|
cffi==1.11.5 # via bcrypt, cryptography, pynacl
|
||||||
chardet==3.0.4 # via requests
|
chardet==3.0.4 # via requests
|
||||||
|
@ -49,7 +49,7 @@ markupsafe==1.0 # via jinja2, mako
|
||||||
marshmallow-sqlalchemy==0.14.0
|
marshmallow-sqlalchemy==0.14.0
|
||||||
marshmallow==2.15.3
|
marshmallow==2.15.3
|
||||||
mock==2.0.0 # via acme
|
mock==2.0.0 # via acme
|
||||||
ndg-httpsclient==0.5.0
|
ndg-httpsclient==0.5.1
|
||||||
paramiko==2.4.1
|
paramiko==2.4.1
|
||||||
pbr==4.1.1 # via mock
|
pbr==4.1.1 # via mock
|
||||||
pem==18.1.0
|
pem==18.1.0
|
||||||
|
|
Loading…
Reference in New Issue