aboutsummaryrefslogtreecommitdiff
path: root/qc_app/db
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-01-18 15:03:36 +0300
committerFrederick Muriuki Muriithi2024-01-18 15:03:36 +0300
commit8b6785be9a61d7ba17a2320a79184bee0914a2f1 (patch)
tree68be72ee3879d25890684cc0cd5a053f9ecda0a9 /qc_app/db
parentaf485aff7d25c1f5128586c550ca36debe24fd66 (diff)
downloadgn-uploader-8b6785be9a61d7ba17a2320a79184bee0914a2f1.tar.gz
UI: Display summary information.
Diffstat (limited to 'qc_app/db')
-rw-r--r--qc_app/db/datasets.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/qc_app/db/datasets.py b/qc_app/db/datasets.py
index 5816146..448db18 100644
--- a/qc_app/db/datasets.py
+++ b/qc_app/db/datasets.py
@@ -1,5 +1,6 @@
"""Functions for accessing the database relating to datasets."""
from datetime import date
+from typing import Optional
import MySQLdb as mdb
from MySQLdb.cursors import DictCursor
@@ -109,7 +110,7 @@ def probeset_create_dataset(conn: mdb.Connection,#pylint: disable=[too-many-argu
}
cursor.execute(
"""
- insert into ProbeSetFreeze(
+ INSERT INTO ProbeSetFreeze(
ProbeFreezeId, AvgId, Name, Name2, FullName, ShortName,
CreateTime, public, DataScale)
VALUES(
@@ -118,3 +119,15 @@ def probeset_create_dataset(conn: mdb.Connection,#pylint: disable=[too-many-argu
""",
dataset)
return {**dataset, "datasetid": cursor.lastrowid}
+
+def probeset_dataset_by_id(
+ conn: mdb.Connection, datasetid: int) -> Optional[dict]:
+ """Fetch a ProbeSet dataset by its ID"""
+ with conn.cursor(cursorclass=DictCursor) as cursor:
+ cursor.execute("SELECT * FROM ProbeSetFreeze WHERE Id=%s",
+ (datasetid,))
+ result = cursor.fetchone()
+ if bool(result):
+ return dict(result)
+
+ return None