in resources/code/scenario1/api-posts/app.py [0:0]
def get_from_db(table):
if local_db:
return db.get(table)
try:
cursor = conn.cursor()
cursor.execute(f"SELECT * FROM {table}")
return cursor.fetchall()
except Exception as error:
return "SQL error running: " + str(error)