aboutsummaryrefslogtreecommitdiff
path: root/gn3/db
diff options
context:
space:
mode:
authorBonfaceKilz2021-05-10 21:07:32 +0300
committerBonfaceKilz2021-05-10 21:07:32 +0300
commitc2ef963c2f0f8a4c9428d48abed1094ff0441935 (patch)
treed14ada489f76db83b9c1aa06691125aa719f1a38 /gn3/db
parent45f4dc8b2079ce97374785984b6f31049f374fd5 (diff)
downloadgenenetwork3-c2ef963c2f0f8a4c9428d48abed1094ff0441935.tar.gz
db: species: Add method for fetching all species
Diffstat (limited to 'gn3/db')
-rw-r--r--gn3/db/species.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/gn3/db/species.py b/gn3/db/species.py
index 91b78e2..0deae4e 100644
--- a/gn3/db/species.py
+++ b/gn3/db/species.py
@@ -6,6 +6,14 @@ from typing import Any, Optional, Tuple
from MySQLdb import escape_string
+def get_all_species(conn: Any) -> Optional[Tuple]:
+ """Return a list of all species"""
+ with conn.cursor() as cursor:
+ cursor.execute("SELECT Name, MenuName FROM Species "
+ "ORDER BY OrderId")
+ return cursor.fetchall()
+
+
def get_chromosome(name: str, is_species: bool, conn: Any) -> Optional[Tuple]:
"""Given either a group or a species Name, return all the species"""
_sql = ("SELECT Chr_Length.Name, Chr_Length.OrderId, "