aboutsummaryrefslogtreecommitdiff
path: root/uploader
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-09-03 11:27:51 -0500
committerFrederick Muriuki Muriithi2024-09-03 11:27:51 -0500
commitea7944b5f5e536c3ad0829dff674f91ba25b548e (patch)
tree8209f49b1ac66b296af62b51347df3bacb547504 /uploader
parentf181dbf3adf8578d2a69ca31a6d8aece6f6d8ffd (diff)
downloadgn-uploader-ea7944b5f5e536c3ad0829dff674f91ba25b548e.tar.gz
Update species queries
* Use the more reliable 'Species.Id' field * Provide more of a species' details
Diffstat (limited to 'uploader')
-rw-r--r--uploader/species/models.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/uploader/species/models.py b/uploader/species/models.py
index bde38ce..481f8be 100644
--- a/uploader/species/models.py
+++ b/uploader/species/models.py
@@ -8,8 +8,8 @@ def all_species(conn: mdb.Connection) -> tuple:
"Retrieve the species from the database."
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(
- "SELECT SpeciesId, SpeciesName, LOWER(Name) AS Name, MenuName, "
- "FullName, TaxonomyId FROM Species")
+ "SELECT Id AS SpeciesId, SpeciesName, LOWER(Name) AS Name, "
+ "MenuName, FullName, TaxonomyId FROM Species")
return tuple(cursor.fetchall())
return tuple()
@@ -18,8 +18,9 @@ def species_by_id(conn: mdb.Connection, speciesid) -> dict:
"Retrieve the species from the database by id."
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(
- "SELECT SpeciesId, SpeciesName, LOWER(Name) AS Name, MenuName, "
- "FullName FROM Species WHERE SpeciesId=%s",
+ "SELECT Id AS SpeciesId, SpeciesName, LOWER(Name) AS Name, "
+ "MenuName, FullName, TaxonomyId, Family, FamilyOrderId, OrderId "
+ "FROM Species WHERE SpeciesId=%s",
(speciesid,))
return cursor.fetchone()