From 37e08e0539fd2b76e9da714cd03980ee8f8dd6e7 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 14 Jul 2023 11:06:24 +0300 Subject: Bug: Assign group within the db context manager Assign the value to group within the db connection's context manager. Initialise the group to an empty tuple at the very begining. Fixes the error noted in https://github.com/genenetwork/gn-docs/blob/master/api/questions-to-ask-GN.md and should now allow the curl invocation: curl -s https://genenetwork.org/api/v_pre1/group/BXD to work as expected. --- wqflask/wqflask/api/router.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/api/router.py b/wqflask/wqflask/api/router.py index 0218f207..a90277c5 100644 --- a/wqflask/wqflask/api/router.py +++ b/wqflask/wqflask/api/router.py @@ -122,7 +122,7 @@ def get_groups_list(species_name=None): @app.route("/api/v_{}/group//".format(version)) @app.route("/api/v_{}/group//.".format(version)) def get_group_info(group_name, species_name=None, file_format="json"): - group = () + group = tuple() with database_connection(get_setting("SQL_URI")) as conn, conn.cursor() as cursor: if species_name: cursor.execute( @@ -152,9 +152,8 @@ def get_group_info(group_name, species_name=None, file_format="json"): "InbredSet.FullName = %s)", ((group_name,)*3) ) - results = cursor.fetchone() + group = cursor.fetchone() - group = results.fetchone() if group: group_dict = { "Id": group[0], -- cgit v1.2.3