aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/data_set.py
diff options
context:
space:
mode:
authorZachary Sloan2012-12-04 16:19:46 -0600
committerZachary Sloan2012-12-04 16:19:46 -0600
commit0e17939e123ec80c4da3f665004b08347aa9480b (patch)
tree5b5f9c92a06b44ca98a8b17fec4bb774c157e0cd /wqflask/base/data_set.py
parent21253f4424fbcdf76212a55011e657ebeb87da82 (diff)
downloadgenenetwork2-0e17939e123ec80c4da3f665004b08347aa9480b.tar.gz
Began changing references to cursor/db_conn to use sqlalchemy
Wrote function for phenotype author searches
Diffstat (limited to 'wqflask/base/data_set.py')
-rwxr-xr-xwqflask/base/data_set.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 34e5eaa1..cd9e810e 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -90,9 +90,7 @@ class DataSet(object):
def get_group(self):
- assert self.cursor
- self.cursor.execute(self.query)
- self.group, self.group_id = self.cursor.fetchone()
+ self.group, self.group_id = g.db.execute(self.query).fetchone()
if self.group == 'BXD300':
self.group = "BXD"
#return group
@@ -107,7 +105,7 @@ class DataSet(object):
"""
- query_args = tuple(self.db_conn.escape_string(x) for x in (
+ query_args = tuple(escape(x) for x in (
(self.type + "Freeze"),
str(webqtlConfig.PUBLICTHRESH),
self.name,
@@ -115,18 +113,22 @@ class DataSet(object):
self.name))
print("query_args are:", query_args)
- query = '''
- SELECT
- Id, Name, FullName, ShortName
- FROM
- %s
- WHERE
- public > %s AND
- (Name = "%s" OR FullName = "%s" OR ShortName = "%s")
- ''' % (query_args)
+ print("""
+ SELECT Id, Name, FullName, ShortName
+ FROM %s
+ WHERE public > %s AND
+ (Name = '%s' OR FullName = '%s' OR ShortName = '%s')
+ """ % (query_args))
+
+ self.id, self.name, self.fullname, self.shortname = g.db.execute("""
+ SELECT Id, Name, FullName, ShortName
+ FROM %s
+ WHERE public > %s AND
+ (Name = '%s' OR FullName = '%s' OR ShortName = '%s')
+ """ % (query_args)).fetchone()
- self.cursor.execute(query)
- self.id, self.name, self.fullname, self.shortname = self.cursor.fetchone()
+ #self.cursor.execute(query)
+ #self.id, self.name, self.fullname, self.shortname = self.cursor.fetchone()
#def genHTML(self, Class='c0dd'):
@@ -185,7 +187,7 @@ class PhenotypeDataSet(DataSet):
WHERE
PublishFreeze.InbredSetId = InbredSet.Id AND
PublishFreeze.Name = "%s"
- ''' % self.db_conn.escape_string(self.name)
+ ''' % escape(self.name)
def check_confidentiality(self):
# (Urgently?) Need to write this