diff options
author | zsloan | 2023-05-03 19:42:33 +0000 |
---|---|---|
committer | zsloan | 2023-05-22 17:23:08 +0000 |
commit | cd19d8fdd71811e88ad56e052ff3c70edcae7f4d (patch) | |
tree | 7b68118d50a4804b33c97dec765dc093d5195883 | |
parent | 421a7cec8e125e54a01a0cd71e0bef64ee8c3462 (diff) | |
download | genenetwork3-cd19d8fdd71811e88ad56e052ff3c70edcae7f4d.tar.gz |
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
-rw-r--r-- | gn3/db/sample_data.py | 2 |
1 files changed, 1 insertions, 1 deletions
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 |