def animal_out(): db = MySQL().connect() cursor = db.cursor() sql = 'SELECT * FROM ANIMAL_OUTS' cursor.execute(sql) results = cursor.fetchall() return render_template('animal_out.html', results=results)
class AnimalIn(Resource): def __init__(self): self.db = MySQL().connect() def get(self): self.cursor = self.db.cursor() self.sql = 'SELECT * FROM ANIMAL_INS' self.cursor.execute(self.sql) self.rows = self.cursor.fetchall() self.db.close() for r in self.rows: r['DATETIME'] = str(r['DATETIME']) return self.rows