diff options
author | Frederick Muriuki Muriithi | 2024-01-08 04:50:42 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-01-08 05:46:25 +0300 |
commit | cace7a50a45c6d227bce52569fcfc2944fbcbe92 (patch) | |
tree | bf625ff1467ba808784fa00c0852c35cd9f1d6ce /qc_app/dbinsert.py | |
parent | 0677b36b2e144b07d7822661129cde0a82115b12 (diff) | |
download | gn-uploader-cace7a50a45c6d227bce52569fcfc2944fbcbe92.tar.gz |
Extract common database functions into a separate package.
Diffstat (limited to 'qc_app/dbinsert.py')
-rw-r--r-- | qc_app/dbinsert.py | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/qc_app/dbinsert.py b/qc_app/dbinsert.py index 2282c8d..881c913 100644 --- a/qc_app/dbinsert.py +++ b/qc_app/dbinsert.py @@ -5,7 +5,6 @@ from typing import Union from functools import reduce from datetime import datetime -import MySQLdb as mdb from redis import Redis from MySQLdb.cursors import DictCursor from flask import ( @@ -31,28 +30,6 @@ def make_menu_items_grouper(grouping_fn=lambda item: item): return {**acc, grouping: (acc[grouping] + (row_values,))} return __grouper__ -def species() -> tuple: - "Retrieve the species from the database." - with database_connection() as conn: - with conn.cursor(cursorclass=DictCursor) as cursor: - cursor.execute( - "SELECT SpeciesId, SpeciesName, LOWER(Name) AS Name, MenuName " - "FROM Species") - return tuple(cursor.fetchall()) - - return tuple() - -def species_by_id(conn: mdb.Connection, speciesid) -> Union[dict, None]: - "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 " - "FROM Species WHERE SpeciesId=%s"), - (speciesid,)) - return cursor.fetchone() - def genechips(): "Retrieve the genechip information from the database" def __organise_by_species__(acc, chip): @@ -94,16 +71,6 @@ def studies_by_species_and_platform(speciesid:int, genechipid:int) -> tuple: return tuple() -def groups_by_species(speciesid:int) -> tuple: - "Retrieve group (InbredSet) information from the database." - with database_connection() as conn: - with conn.cursor(cursorclass=DictCursor) as cursor: - query = "SELECT * FROM InbredSet WHERE SpeciesId=%s" - cursor.execute(query, (speciesid,)) - return tuple(cursor.fetchall()) - - return tuple() - def organise_groups_by_family(acc:dict, group:dict) -> dict: "Organise the group (InbredSet) information by the group field" family = group["Family"] |