docs: def ping_connection(dbapi_connection, connection_record, connection_proxy):
      """Ensure connections are valid.
  
      From: `http://docs.sqlalchemy.org/en/rel_0_8/core/pooling.html`
  
      In case db has been restarted pool may return invalid connections.
      """
      cursor = dbapi_connection.cursor()
      try:
          cursor.execute("SELECT 1")
      except Exception:
          # optional - dispose the whole pool
          # instead of invalidating one at a time
          # connection_proxy._pool.dispose()
  
          # raise DisconnectionError - pool will try
          # connecting again up to three times before raising.
          raise sa.exc.DisconnectionError()
      cursor.close()