diff options
author | Frederick Muriuki Muriithi | 2024-09-05 12:31:48 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-09-05 14:19:55 -0500 |
commit | e13a694540ee65f401652d9ebdb5f845c15fb97e (patch) | |
tree | 93c74cfe70d082b37867ae60c79e9e4fdffa33c8 /uploader/species/models.py | |
parent | b6a38df0eaedb9ac4bb4b602643ca1e97f889b49 (diff) | |
download | gn-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.py | 8 |
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()) |