This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 6081f71 [health] Adding DB check to /health (#4062)
6081f71 is described below
commit 6081f7161a8be030a77d5453c73ba85ab1c442d5
Author: John Bodley <[email protected]>
AuthorDate: Sat Dec 16 11:59:41 2017 +1300
[health] Adding DB check to /health (#4062)
---
superset/views/core.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/superset/views/core.py b/superset/views/core.py
index 00254b4..8801419 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -28,6 +28,7 @@ import pandas as pd
import sqlalchemy as sqla
from sqlalchemy import create_engine
from sqlalchemy.engine.url import make_url
+from sqlalchemy.exc import OperationalError
from unidecode import unidecode
from werkzeug.routing import BaseConverter
from werkzeug.utils import secure_filename
@@ -654,6 +655,11 @@ appbuilder.add_view(
@app.route('/health')
def health():
+ try:
+ db.session.execute('SELECT 1')
+ except OperationalError:
+ return Response('BAD', status=500)
+
return 'OK'
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].