From 923e94c39f5768f836dbf5fc29b0186c13ccc86b Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Thu, 23 Jun 2016 12:51:12 +0000 Subject: Logger: SQL --- wqflask/base/data_set.py | 8 ++++---- wqflask/base/trait.py | 12 ++++++------ wqflask/wqflask/show_trait/show_trait.py | 2 -- 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'wqflask') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index a50f5235..ffc5917a 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -1137,7 +1137,7 @@ class TempDataSet(DataSet): return desc def get_group(self): - self.cursor.execute(""" + query = """ SELECT InbredSet.Name, InbredSet.Id FROM @@ -1145,9 +1145,9 @@ class TempDataSet(DataSet): WHERE Temp.InbredSetId = InbredSet.Id AND Temp.Name = "%s" - """, self.name) - self.group, self.group_id = self.cursor.fetchone() - #return self.group + """ % self.name + logger.sql(query) + self.group, self.group_id = g.db.execute(query).fetchone() def retrieve_sample_data(self, trait): query = """ diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 4d4d1a42..afde3dbe 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -670,12 +670,12 @@ class GeneralTrait(object): """ if self.cellid: - self.cursor.execute(""" - select ProbeFreeze.Name from ProbeFreeze, ProbeSetFreeze - where - ProbeFreeze.Id = ProbeSetFreeze.ProbeFreezeId AND - ProbeSetFreeze.Id = %d""" % thisTrait.dataset.id) - probeDBName = self.cursor.fetchone()[0] + query = """ select ProbeFreeze.Name from ProbeFreeze, ProbeSetFreeze where + ProbeFreeze.Id = + ProbeSetFreeze.ProbeFreezeId AND + ProbeSetFreeze.Id = %d""" % thisTrait.dataset.id + logger.sql(query) + probeDBName = g.db.execute(query).fetchone()[0] return dict(name = probeDBName, url = None) else: diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 5340301a..3eea3f4a 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -1250,8 +1250,6 @@ def get_nearest_marker(this_trait, this_db): GenoFreeze.Id = GenoXRef.GenoFreezeId AND GenoFreeze.Name = '{}' ORDER BY ABS( Geno.Mb - {}) LIMIT 1""".format(this_chr, this_db.group.name+"Geno", this_mb) - logger.debug("query:", query) - logger.sql(query) result = g.db.execute(query).fetchall() logger.debug("result:", result) -- cgit v1.2.3