aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-02-24 12:05:26 +0300
committerFrederick Muriuki Muriithi2023-02-24 12:34:11 +0300
commitd6499ce9f64d6f71d389e2ad32b112147a2f162a (patch)
tree86d7e13c87c30fd881c365143b7e9eefe0cf7ec2 /gn3
parent59cadd833fdd638ca5a166ee490caea8df0046f6 (diff)
downloadgenenetwork3-d6499ce9f64d6f71d389e2ad32b112147a2f162a.tar.gz
auth: resources: Fix queries loading resources data.
Diffstat (limited to 'gn3')
-rw-r--r--gn3/auth/authorisation/resources/models.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/gn3/auth/authorisation/resources/models.py b/gn3/auth/authorisation/resources/models.py
index 40e12ba..d3023ac 100644
--- a/gn3/auth/authorisation/resources/models.py
+++ b/gn3/auth/authorisation/resources/models.py
@@ -207,6 +207,7 @@ def attach_resource_data(cursor: db.DbCursor, resource: Resource) -> Resource:
dict(data_row) for data_row in
resource_data_function[category.resource_category_key](
cursor, resource.resource_id))
+ print(f"DATA ROWS: {data_rows}")
return Resource(
resource.group, resource.resource_id, resource.resource_name,
resource.resource_category, resource.public, data_rows)
@@ -216,7 +217,9 @@ def mrna_resource_data(
"""Fetch data linked to a mRNA resource"""
cursor.execute(
"SELECT * FROM mrna_resources AS mr INNER JOIN linked_group_data AS lgd"
- " ON mr.dataset_id=lgd.dataset_or_trait_id WHERE mr.resource_id=?",
+ " ON (mr.dataset_id=lgd.dataset_or_trait_id "
+ "AND mr.dataset_type=lgd.dataset_type) "
+ "WHERE mr.resource_id=?",
(str(resource_id),))
return cursor.fetchall()
@@ -226,7 +229,8 @@ def genotype_resource_data(
cursor.execute(
"SELECT * FROM genotype_resources AS gr "
"INNER JOIN linked_group_data AS lgd "
- "ON gr.trait_id=lgd.dataset_or_trait_id "
+ "ON (gr.trait_id=lgd.dataset_or_trait_id "
+ "AND gr.dataset_type=lgd.dataset_type) "
"WHERE gr.resource_id=?",
(str(resource_id),))
return cursor.fetchall()
@@ -237,7 +241,8 @@ def phenotype_resource_data(
cursor.execute(
"SELECT * FROM phenotype_resources AS pr "
"INNER JOIN linked_group_data AS lgd "
- "ON pr.trait_id=lgd.dataset_or_trait_id "
+ "ON (pr.trait_id=lgd.dataset_or_trait_id "
+ "AND pr.dataset_type=lgd.dataset_type) "
"WHERE pr.resource_id=?",
(str(resource_id),))
return cursor.fetchall()