From 7022a3145586a7e5298bf2bf50226eb63a51d563 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 12 Apr 2023 11:41:43 +0300 Subject: auth: Enable listing of unlinked genotype/mRNA group data. --- gn3/auth/authorisation/resources/models.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'gn3/auth/authorisation/resources/models.py') diff --git a/gn3/auth/authorisation/resources/models.py b/gn3/auth/authorisation/resources/models.py index afda5e8..4c71ade 100644 --- a/gn3/auth/authorisation/resources/models.py +++ b/gn3/auth/authorisation/resources/models.py @@ -217,9 +217,8 @@ def mrna_resource_data( cursor: db.DbCursor, resource_id: UUID) -> Sequence[sqlite3.Row]: """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 " - "AND mr.dataset_type=lgd.dataset_type) " + "SELECT * FROM mrna_resources AS mr INNER JOIN linked_mrna_data AS lmr" + " ON mr.data_link_id=lmr.data_link_id " "WHERE mr.resource_id=?", (str(resource_id),)) return cursor.fetchall() @@ -229,9 +228,8 @@ def genotype_resource_data( """Fetch data linked to a Genotype resource""" cursor.execute( "SELECT * FROM genotype_resources AS gr " - "INNER JOIN linked_group_data AS lgd " - "ON (gr.trait_id=lgd.dataset_or_trait_id " - "AND gr.dataset_type=lgd.dataset_type) " + "INNER JOIN linked_genotype_data AS lgd " + "ON gr.data_link_id=lgd.data_link_id " "WHERE gr.resource_id=?", (str(resource_id),)) return cursor.fetchall() @@ -241,9 +239,9 @@ def phenotype_resource_data( """Fetch data linked to a Phenotype resource""" cursor.execute( "SELECT * FROM phenotype_resources AS pr " - "INNER JOIN linked_group_data AS lgd " - "ON (pr.trait_id=lgd.dataset_or_trait_id " - "AND pr.dataset_type=lgd.dataset_type) " + "INNER JOIN linked_phenotype_data AS lpd " + "ON (pr.trait_id=lpd.dataset_or_trait_id " + "AND pr.dataset_type=lpd.dataset_type) " "WHERE pr.resource_id=?", (str(resource_id),)) return cursor.fetchall() -- cgit v1.2.3