diff options
| author | Frederick Muriuki Muriithi | 2023-07-14 11:06:24 +0300 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2023-07-14 11:08:00 +0300 |
| commit | 37e08e0539fd2b76e9da714cd03980ee8f8dd6e7 (patch) | |
| tree | 1f06c07a8ec1a2a10f055483b64ea900237f01ee | |
| parent | fc301388999c852e43c85cc3daa309bd7fd54f53 (diff) | |
| download | genenetwork2-37e08e0539fd2b76e9da714cd03980ee8f8dd6e7.tar.gz | |
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.
| -rw-r--r-- | wqflask/wqflask/api/router.py | 5 |
1 files changed, 2 insertions, 3 deletions
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/<path:species_name>/<path:group_name>".format(version)) @app.route("/api/v_{}/group/<path:species_name>/<path:group_name>.<path:file_format>".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], |
