From 0bc973487b39b087630c9edf2ceae6ea646b325d Mon Sep 17 00:00:00 2001 From: erichard <elliot.richard@lal.in2p3.fr> Date: Mon, 3 Aug 2020 09:50:30 +0200 Subject: [PATCH] customable tables : put all the selected attributes into JSON. We don't know how the label and element tables will b. That's is the reason why we reused element and label structure define by the developper of labelstower framework. --- labelstower/request_db.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/labelstower/request_db.py b/labelstower/request_db.py index 0af3790..cc00871 100644 --- a/labelstower/request_db.py +++ b/labelstower/request_db.py @@ -11,5 +11,8 @@ def send_query_to_db(query: str) -> List[Dict[int, str]] : stmt = bp.db.text(query) response = bp.db.session.execute(stmt) for row in response: - result.append({"id": row[0], "name": row[1]}) + record = {} + for index in range(len(row)): + record.update({str(row.keys()[index]):row[index]}) + result.append(record) return result \ No newline at end of file -- GitLab