From cd19d8fdd71811e88ad56e052ff3c70edcae7f4d Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 3 May 2023 19:42:33 +0000 Subject: Fix sample data CSV query to only fetch distinct samples There's probably a better way to fix this query (it was previously returning each sample twice), but DISTINCT was the easiest way I could come up with --- gn3/db/sample_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3/db') diff --git a/gn3/db/sample_data.py b/gn3/db/sample_data.py index 29a35d6..5dad923 100644 --- a/gn3/db/sample_data.py +++ b/gn3/db/sample_data.py @@ -89,7 +89,7 @@ def get_trait_csv_sample_data( """Fetch a trait and return it as a csv string""" with conn.cursor() as cursor: cursor.execute(""" -SELECT concat(st.Name, ',', ifnull(pd.value, 'x'), ',', +SELECT DISTINCT concat(st.Name, ',', ifnull(pd.value, 'x'), ',', ifnull(ps.error, 'x'), ',', ifnull(ns.count, 'x')) AS 'Data' FROM PublishFreeze pf JOIN PublishXRef px ON px.InbredSetId = pf.InbredSetId JOIN PublishData pd ON pd.Id = px.DataId JOIN Strain st ON pd.StrainId = st.Id -- cgit v1.2.3