mirror of
https://github.com/apache/superset.git
synced 2024-09-12 16:49:40 -04:00
[health] Adding DB check to /health (#4062)
This commit is contained in:
parent
c21513fb8c
commit
6081f7161a
@ -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'
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user