diff options
author | Pjotr Prins | 2016-06-26 09:50:29 +0000 |
---|---|---|
committer | Pjotr Prins | 2016-06-26 09:50:29 +0000 |
commit | d1192b1f244e8976fb53c260179eb3715029ebf4 (patch) | |
tree | 9f2e94682b34c8ffa019d4beda90f8c2b1080319 /wqflask/base/data_set.py | |
parent | eb68b396be51c98e9e9a9027f8b1bb9b05e692c0 (diff) | |
download | genenetwork2-d1192b1f244e8976fb53c260179eb3715029ebf4.tar.gz |
gn_server: introduced one new query to fetch a dataset record and force fetch1 to return a tuple
Diffstat (limited to 'wqflask/base/data_set.py')
-rw-r--r-- | wqflask/base/data_set.py | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index c70738f7..ec3750dd 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -466,14 +466,20 @@ class DataSet(object): Weve_Renamed_This_As_Group def retrieve_other_names(self): - """ - If the data set name parameter is not found in the 'Name' field of the data set table, - check if it is actually the FullName or ShortName instead. + """This method fetches the the dataset names in search_result. + + If the data set name parameter is not found in the 'Name' field of + the data set table, check if it is actually the FullName or + ShortName instead. - This is not meant to retrieve the data set info if no name at all is passed. + This is not meant to retrieve the data set info if no name at + all is passed. """ + def helper(r): + return r["id"],r["name"],r["full_name"],r["short_name"],r["data_scale"],r["tissue"] + try: if self.type == "ProbeSet": query_args = tuple(escape(x) for x in ( @@ -482,14 +488,18 @@ class DataSet(object): self.name, self.name)) - self.id, self.name, self.fullname, self.shortname, self.data_scale, self.tissue = fetchone(""" - SELECT ProbeSetFreeze.Id, ProbeSetFreeze.Name, ProbeSetFreeze.FullName, ProbeSetFreeze.ShortName, ProbeSetFreeze.DataScale, Tissue.Name - FROM ProbeSetFreeze, ProbeFreeze, Tissue - WHERE ProbeSetFreeze.public > %s AND - ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id AND - ProbeFreeze.TissueId = Tissue.Id AND - (ProbeSetFreeze.Name = '%s' OR ProbeSetFreeze.FullName = '%s' OR ProbeSetFreeze.ShortName = '%s') - """ % (query_args)) + # self.id, self.name, self.fullname, self.shortname, self.data_scale, self.tissue = + result = fetch1(""" +SELECT ProbeSetFreeze.Id, ProbeSetFreeze.Name, ProbeSetFreeze.FullName, ProbeSetFreeze.ShortName, ProbeSetFreeze.DataScale, Tissue.Name +FROM ProbeSetFreeze, ProbeFreeze, Tissue +WHERE ProbeSetFreeze.public > %s +AND ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id +AND ProbeFreeze.TissueId = Tissue.Id +AND (ProbeSetFreeze.Name = '%s' OR ProbeSetFreeze.FullName = '%s' OR ProbeSetFreeze.ShortName = '%s') + """ % (query_args), + "/dataset/"+self.name+".json",helper) + self.id, self.name, self.fullname, self.shortname, self.data_scale, self.tissue = result + logger.debug("retrieve_other_names result:",result) else: query_args = tuple(escape(x) for x in ( (self.type + "Freeze"), |