From ad1a81042a4435f61907784a68ae436ec5a9c7c1 Mon Sep 17 00:00:00 2001 From: assar Date: Sun, 4 Jun 2017 22:53:05 +0000 Subject: [PATCH] Fixed get part info --- server.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index 0b6819d..f52cba8 100644 --- a/server.py +++ b/server.py @@ -17,11 +17,13 @@ def index(): @app.route('/getpartinfo/') def get_part_info(partID): - s = 'select * from parts where id = :id' - r = db_engine.execute(s, id=partID) - l = dict(r) + s = 'select * from parts where id = :id;' + r = db_engine.execute(text(s), id=partID) + l = [] + for row in r: + l.append(dict(row)) r.close() - return json.dumps(l) + return json.dumps(l[0]) @app.route('/query//') def query(filter, query):