aboutsummaryrefslogtreecommitdiff
path: root/uploader/dbinsert.py
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/dbinsert.py')
-rw-r--r--uploader/dbinsert.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/uploader/dbinsert.py b/uploader/dbinsert.py
index 66b0c41..559dc5e 100644
--- a/uploader/dbinsert.py
+++ b/uploader/dbinsert.py
@@ -41,7 +41,7 @@ def genechips():
return {**acc, speciesid: (chip,)}
return {**acc, speciesid: acc[speciesid] + (chip,)}
- with database_connection() as conn:
+ with database_connection(app.config["SQL_URI"]) as conn:
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute("SELECT * FROM GeneChip ORDER BY GeneChipName ASC")
return reduce(__organise_by_species__, cursor.fetchall(), {})
@@ -50,7 +50,7 @@ def genechips():
def platform_by_id(genechipid:int) -> Union[dict, None]:
"Retrieve the gene platform by id"
- with database_connection() as conn:
+ with database_connection(app.config["SQL_URI"]) as conn:
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(
"SELECT * FROM GeneChip WHERE GeneChipId=%s",
@@ -59,7 +59,7 @@ def platform_by_id(genechipid:int) -> Union[dict, None]:
def studies_by_species_and_platform(speciesid:int, genechipid:int) -> tuple:
"Retrieve the studies by the related species and gene platform"
- with database_connection() as conn:
+ with database_connection(app.config["SQL_URI"]) as conn:
with conn.cursor(cursorclass=DictCursor) as cursor:
query = (
"SELECT Species.SpeciesId, ProbeFreeze.* "
@@ -83,7 +83,7 @@ def organise_groups_by_family(acc:dict, group:dict) -> dict:
def tissues() -> tuple:
"Retrieve type (Tissue) information from the database."
- with database_connection() as conn:
+ with database_connection(app.config["SQL_URI"]) as conn:
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute("SELECT * FROM Tissue ORDER BY Name")
return tuple(cursor.fetchall())
@@ -158,7 +158,7 @@ def create_study():
assert form.get("inbredsetid"), "group"
assert form.get("tissueid"), "type/tissue"
- with database_connection() as conn:
+ with database_connection(app.config["SQL_URI"]) as conn:
with conn.cursor(cursorclass=DictCursor) as cursor:
values = (
form["genechipid"],
@@ -190,7 +190,7 @@ def create_study():
def datasets_by_study(studyid:int) -> tuple:
"Retrieve datasets associated with a study with the ID `studyid`."
- with database_connection() as conn:
+ with database_connection(app.config["SQL_URI"]) as conn:
with conn.cursor(cursorclass=DictCursor) as cursor:
query = "SELECT * FROM ProbeSetFreeze WHERE ProbeFreezeId=%s"
cursor.execute(query, (studyid,))
@@ -200,7 +200,7 @@ def datasets_by_study(studyid:int) -> tuple:
def averaging_methods() -> tuple:
"Retrieve averaging methods from database"
- with database_connection() as conn:
+ with database_connection(app.config["SQL_URI"]) as conn:
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute("SELECT * FROM AvgMethod")
return tuple(cursor.fetchall())
@@ -209,7 +209,7 @@ def averaging_methods() -> tuple:
def dataset_datascales() -> tuple:
"Retrieve datascales from database"
- with database_connection() as conn:
+ with database_connection(app.config["SQL_URI"]) as conn:
with conn.cursor() as cursor:
cursor.execute(
'SELECT DISTINCT DataScale FROM ProbeSetFreeze '
@@ -261,7 +261,7 @@ def create_dataset():
assert form.get("datasetconfidentiality"), "Dataset confidentiality"
assert form.get("datasetdatascale"), "Dataset Datascale"
- with database_connection() as conn:
+ with database_connection(app.config["SQL_URI"]) as conn:
with conn.cursor(cursorclass=DictCursor) as cursor:
datasetname = form["datasetname"]
cursor.execute("SELECT * FROM ProbeSetFreeze WHERE Name=%s",
@@ -299,7 +299,7 @@ def create_dataset():
def study_by_id(studyid:int) -> Union[dict, None]:
"Get a study by its Id"
- with database_connection() as conn:
+ with database_connection(app.config["SQL_URI"]) as conn:
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(
"SELECT * FROM ProbeFreeze WHERE Id=%s",
@@ -308,7 +308,7 @@ def study_by_id(studyid:int) -> Union[dict, None]:
def dataset_by_id(datasetid:int) -> Union[dict, None]:
"Retrieve a dataset by its id"
- with database_connection() as conn:
+ with database_connection(app.config["SQL_URI"]) as conn:
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(
("SELECT AvgMethod.Name AS AvgMethodName, ProbeSetFreeze.* "