title: Flask-SQLAlchemy check if database server is responsive
body: <p>I am using flask-SQLAlchemy for my webservice. I would like to have an endpoint that checks status of the utilized MySQL database availability/responsiveness. How would I go about it? Thanks.</p>
  
  <p>Here are relevant pieces of my code:</p>
  
  <p>mywebsvc.py</p>
  
  <pre><code>...
  app = Flask(__name__)
  
  app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://mylogin:mypw@localhost/mydb'
  
  db.init_app(app)
  ...
  </code></pre>
  
  <p>models_shared.py</p>
  
  <pre><code>from flask.ext.sqlalchemy import SQLAlchemy
  
  db = SQLAlchemy()
  </code></pre>
  
  <p>models.py</p>
  
  <pre><code>from models_shared import db
  
  class Car(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      make = db.Column(db.String(64), index=True, unique=True)
      color = db.Column(db.String(64), index=False, unique=False)
  </code></pre>
  
  <p>routes.py</p>
  
  <pre><code>...
  @app.route('/is_available', methods=['GET'])
  def is_available():
      #???
  </code></pre>