aboutsummaryrefslogtreecommitdiff
path: root/gn3/db
diff options
context:
space:
mode:
authorJohn Nduli2024-08-26 12:53:52 +0300
committerBonfaceKilz2024-08-26 13:06:47 +0300
commita8e3a4fca46df0776b7efa1e82b1f44cc1a8938f (patch)
tree1ac39ee9cfde4b518fa3ded9adfa00b5e33409e7 /gn3/db
parent7b2a1794c1b7e7c589b1abe6d307b2a7e4cd2c42 (diff)
downloadgenenetwork3-a8e3a4fca46df0776b7efa1e82b1f44cc1a8938f.tar.gz
chore: fix pylint errors
Diffstat (limited to 'gn3/db')
-rw-r--r--gn3/db/wiki.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/gn3/db/wiki.py b/gn3/db/wiki.py
index a56f26c..c3cfee0 100644
--- a/gn3/db/wiki.py
+++ b/gn3/db/wiki.py
@@ -1,11 +1,14 @@
+"""Helper functions to access wiki entries"""
+
from typing import List
class MissingDBDataException(Exception):
- pass
+ """Error due to DB missing some data"""
def get_species_id(cursor, species_name: str) -> int:
+ """Find species id given species `Name`"""
cursor.execute("SELECT SpeciesID from Species WHERE Name = %s", (species_name,))
species_ids = cursor.fetchall()
if len(species_ids) != 1:
@@ -16,6 +19,7 @@ def get_species_id(cursor, species_name: str) -> int:
def get_next_comment_version(cursor, comment_id: int) -> int:
+ """Find the version to add, usually latest_version + 1"""
cursor.execute(
"SELECT MAX(versionId) as version_id from GeneRIF WHERE Id = %s", (comment_id,)
)
@@ -26,6 +30,7 @@ def get_next_comment_version(cursor, comment_id: int) -> int:
def get_categories_ids(cursor, categories: List[str]) -> List[int]:
+ """Get the categories_ids from a list of category strings"""
cursor.execute("SELECT Name, Id from GeneCategory")
raw_categories = cursor.fetchall()
dict_cats = dict(raw_categories)