aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-rw-r--r--gn3/db/phenotypes.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/gn3/db/phenotypes.py b/gn3/db/phenotypes.py
index 54630b4..220284d 100644
--- a/gn3/db/phenotypes.py
+++ b/gn3/db/phenotypes.py
@@ -194,3 +194,13 @@ def fetch_metadata(conn: DBConnection, phenotype_id: int) -> dict:
"WHERE Id=%(phenotype_id)s"),
{"phenotype_id": phenotype_id})
return cursor.fetchone()
+
+def fetch_publication(conn: DBConnection, publication_id: int) -> dict:
+ """Fetch the publication by its ID."""
+ with conn.cursor(cursorclass=DictCursor) as cursor:
+ cols = ', '.join(_mapping_to_query_columns_(publication_mapping))
+ cursor.execute(
+ (f"SELECT Id as id, {cols} FROM Publication "
+ "WHERE Id=%(publication_id)s"),
+ {"publication_id": publication_id})
+ return cursor.fetchone()