From af1d36e0847d2bcd878ea7343bd1c858ae4fa91f Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 2 Mar 2022 15:47:52 +0300 Subject: Fix faulty SQL query string when deleting case-attributes --- gn3/db/sample_data.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gn3/db/sample_data.py b/gn3/db/sample_data.py index 3d2faca..80f8292 100644 --- a/gn3/db/sample_data.py +++ b/gn3/db/sample_data.py @@ -197,13 +197,12 @@ def delete_sample_data(conn: Any, if value != "x": with conn.cursor() as cursor: cursor.execute( - ("DELETE FROM CaseAttributeXRefNew " - "WHERE StrainId = " - "(SELECT CaseAttributeId FROM " - f"CaseAttribute WHERE NAME = %s) " - "AND InbredSetId = %s"), - (strain_id, case_attr, inbredset_id) - ) + "DELETE FROM CaseAttributeXRefNew " + "WHERE StrainId = %s AND CaseAttributeId = " + "(SELECT CaseAttributeId FROM " + "CaseAttribute WHERE Name = %s) " + "AND InbredSetId = %s", + (strain_id, case_attr, inbredset_id)) return cursor.rowcount return 0 -- cgit v1.2.3