From 2214650621ee57b4c427bf8b5cab1128eb06db93 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sun, 19 Jun 2016 08:50:55 +0000 Subject: Logger: started logging SQL --- wqflask/dbFunction/webqtlDatabaseFunction.py | 34 +++++++++++----------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'wqflask/dbFunction') diff --git a/wqflask/dbFunction/webqtlDatabaseFunction.py b/wqflask/dbFunction/webqtlDatabaseFunction.py index 299114b4..1bc67992 100644 --- a/wqflask/dbFunction/webqtlDatabaseFunction.py +++ b/wqflask/dbFunction/webqtlDatabaseFunction.py @@ -20,13 +20,15 @@ # # This module is used by GeneNetwork project (www.genenetwork.org) - from flask import Flask, g import MySQLdb import string from base import webqtlConfig +from utility.logger import getLogger +logger = getLogger(__name__ ) + ########################################################################### #output: cursor instance #function: connect to database and return cursor instance @@ -76,33 +78,23 @@ def getAllSpecies(cursor=None): allSpecies = cursor.fetchall() return allSpecies -########################################################################### -#input: cursor, RISet (string) -#output: specie's name (string), value will be None or else -#function: retrieve specie's name info based on RISet -########################################################################### - def retrieve_species(group): - return g.db.execute("""select Species.Name - from Species, InbredSet - where InbredSet.Name = %s and - InbredSet.SpeciesId = Species.Id""", (group)).fetchone()[0] + logger.debug("retrieve_species",group) + logger.sql(""""select Species.Name from Species, InbredSet where InbredSet.Name = %s and InbredSet.SpeciesId = Species.Id""", (group)) + + return g.db.execute("""select Species.Name from Species, InbredSet where InbredSet.Name = +%s and InbredSet.SpeciesId = Species.Id""", (group)).fetchone()[0] def retrieve_species_id(group): return g.db.execute("select SpeciesId from InbredSet where Name = %s", (group)).fetchone()[0] -########################################################################### -# input: cursor -# output: tissProbeSetFreezeIdList (list), -# nameList (list), -# fullNameList (list) -# function: retrieve all TissueProbeSetFreezeId,Name,FullName info -# from TissueProbeSetFreeze table. -# These data will listed in the dropdown menu in the first page of Tissue Correlation -########################################################################### - def getTissueDataSet(cursor=None): + """Retrieve all TissueProbeSetFreezeId,Name,FullName info from +TissueProbeSetFreeze table. These data will listed in the dropdown +menu in the first page of Tissue Correlation + + """ tissProbeSetFreezeIdList=[] nameList =[] fullNameList = [] -- cgit v1.2.3