aboutsummaryrefslogtreecommitdiff
path: root/uploader/species/models.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-09-05 12:31:48 -0500
committerFrederick Muriuki Muriithi2024-09-05 14:19:55 -0500
commite13a694540ee65f401652d9ebdb5f845c15fb97e (patch)
tree93c74cfe70d082b37867ae60c79e9e4fdffa33c8 /uploader/species/models.py
parentb6a38df0eaedb9ac4bb4b602643ca1e97f889b49 (diff)
downloadgn-uploader-e13a694540ee65f401652d9ebdb5f845c15fb97e.tar.gz
Provide basic UI for editing the Species details.
Diffstat (limited to 'uploader/species/models.py')
-rw-r--r--uploader/species/models.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/uploader/species/models.py b/uploader/species/models.py
index 53e7de0..cea3549 100644
--- a/uploader/species/models.py
+++ b/uploader/species/models.py
@@ -81,3 +81,11 @@ def save_species(conn: mdb.Connection,
**species,
"species_id": species_id
}
+
+
+def species_families(conn: mdb.Connection) -> tuple:
+ """Retrieve the families under which species are grouped."""
+ with conn.cursor(cursorclass=DictCursor) as cursor:
+ cursor.execute(
+ "SELECT DISTINCT(Family) FROM Species WHERE Family IS NOT NULL")
+ return tuple(fam["Family"] for fam in cursor.fetchall())