def sample(): cur = conn.cursor() cur.execute( "SELECT name, data FROM data OFFSET floor(random() * (SELECT count(*) FROM data)) LIMIT 1" ) name, data = cur.fetchone() ret = {"data": data, "name": name} return Response(json.dumps(ret))
def submit(): data = request.form['data'] print request.form['name'] cur = conn.cursor() cur.execute("INSERT into images2 (name, data, track, email, gid) VALUES (%s, %s, %s, %s, %s)", (request.form['name'], request.form['data'], request.form['track'], request.form['email'], request.form['gid'])) conn.commit() cur.close() return "thanks"
def submit(): data = request.form['data'] print(request.form['name']) cur = conn.cursor() cur.execute( "INSERT into images2 (name, data, track, email, gid) VALUES (%s, %s, %s, %s, %s)", (request.form['name'], request.form['data'], request.form['track'], request.form['email'], request.form['gid'])) conn.commit() cur.close() return "thanks"
def suggestion(name): cur = conn.cursor() cur.execute("SELECT data FROM suggestions WHERE name = %s", (name, )) data = cur.fetchone()[0] ret = {"data": data} return Response(json.dumps(ret))
def suggestion(name): cur = conn.cursor() cur.execute("SELECT data FROM suggestions WHERE name = %s", (name,)) data = cur.fetchone()[0] ret = {"data": data} return Response(json.dumps(ret))
def sample(): cur = conn.cursor() cur.execute("SELECT name, data FROM data OFFSET floor(random() * (SELECT count(*) FROM data)) LIMIT 1") name, data = cur.fetchone() ret = {"data": data, "name": name} return Response(json.dumps(ret))