def db_status(): try: db.query('SELECT 1') status = {'status': 'ok', 'message': 'Fine'} except: cls, e, tb = exc_info() message = 'DB Error: %s' % (e) status = {'status': 'error', 'message': message} return jsonify(status)
def count(self): return db.query('SELECT COUNT(*) FROM ' + self.table)[0][0]