aboutsummaryrefslogtreecommitdiff
path: root/wqflask/dbFunction
diff options
context:
space:
mode:
authorZachary Sloan2012-12-04 18:08:09 -0600
committerZachary Sloan2012-12-04 18:08:09 -0600
commit01785471d63de156fa9787a0fb38c9df09824183 (patch)
tree00eaac20327dde5647bf58a87e5beb1ddd1a3360 /wqflask/dbFunction
parent0e17939e123ec80c4da3f665004b08347aa9480b (diff)
downloadgenenetwork2-01785471d63de156fa9787a0fb38c9df09824183.tar.gz
Changed parser to allow quotes (i.e. name="rw williams")
Renamed webqtlTrait to GeneralTrait and began rewriting parts Changed database code in many places to use simple sqlalchemy
Diffstat (limited to 'wqflask/dbFunction')
-rwxr-xr-xwqflask/dbFunction/webqtlDatabaseFunction.py26
1 files changed, 9 insertions, 17 deletions
diff --git a/wqflask/dbFunction/webqtlDatabaseFunction.py b/wqflask/dbFunction/webqtlDatabaseFunction.py
index 1e028ecc..299114b4 100755
--- a/wqflask/dbFunction/webqtlDatabaseFunction.py
+++ b/wqflask/dbFunction/webqtlDatabaseFunction.py
@@ -21,6 +21,8 @@
# This module is used by GeneNetwork project (www.genenetwork.org)
+from flask import Flask, g
+
import MySQLdb
import string
from base import webqtlConfig
@@ -80,25 +82,15 @@ def getAllSpecies(cursor=None):
#function: retrieve specie's name info based on RISet
###########################################################################
-def retrieveSpecies(cursor=None, group=None):
- try:
- cursor.execute("select Species.Name from Species, InbredSet where InbredSet.Name = '%s' and InbredSet.SpeciesId = Species.Id" % group)
- return cursor.fetchone()[0]
- except:
- return None
+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]
-###########################################################################
-#input: cursor, RISet (string)
-#output: specie's Id (string), value will be None or else
-#function: retrieve specie's Id info based on RISet
-###########################################################################
+def retrieve_species_id(group):
+ return g.db.execute("select SpeciesId from InbredSet where Name = %s", (group)).fetchone()[0]
-def retrieveSpeciesId(cursor=None, RISet=None):
- try:
- cursor.execute("select SpeciesId from InbredSet where Name = '%s'" % RISet)
- return cursor.fetchone()[0]
- except:
- return None
###########################################################################
# input: cursor