/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
vgroup::VGroup Class Reference

List of all members.

Public Member Functions

def __init__
def populate
def __call__
def persist
def tuple_keys
def column
def __repr__

Public Attributes

 sql
 xcol
 fmt
 lbl
 fld

Detailed Description

Definition at line 131 of file vgroup.py.


Constructor & Destructor Documentation

def vgroup::VGroup::__init__ (   self,
  args,
  kwa 
)
:param xf: space delimited list of context fields to **group by** OR None for default "SITEMASK SIMMASK SUBSITE TASK" 
:param qf: space delimited list of other fields to report ranges for OR None for default "SEQNO AGGREGATENO"
:param tf: space delimited list of date fields to report ranges for OR None for default "TIMESTART TIMEEND INSERTDATE VERSIONDATE"

Definition at line 133 of file vgroup.py.

00133                                     :  
00134         """
00135         :param xf: space delimited list of context fields to **group by** OR None for default "SITEMASK SIMMASK SUBSITE TASK" 
00136         :param qf: space delimited list of other fields to report ranges for OR None for default "SEQNO AGGREGATENO"
00137         :param tf: space delimited list of date fields to report ranges for OR None for default "TIMESTART TIMEEND INSERTDATE VERSIONDATE"
00138         """
00139 
00140         dict.__init__(self, *args, **kwa)
00141 
00142         xf = self.get('xf',None)
00143         qf = self.get('qf',None)
00144         tf = self.get('tf',None)
00145 
00146         xf = map(VF, xf.split() if xf else VF.xf) 
00147         qf = map(VF, qf.split() if qf else VF.qf) 
00148         tf = map(VF, tf.split() if tf else VF.tf) 
00149 
00150         cf = [VF("count(*)",as_="N")]
00151 
00152         xcol = map(lambda _:_.sqlcol, xf )
00153         gcol = ",".join(xcol)
00154 
00155         col  = map(lambda _:[_.sqlcol],  xf + cf ) 
00156         col += map(lambda _:_.sqlmm,     qf + tf )  
00157 
00158         fld  = map(lambda _:[_.as_], xf + cf )
00159         fld += map(lambda _:_.asmm,  qf + tf )
00160 
00161         fmt  = map(lambda _:[_.ffmt] , xf + cf )
00162         fmt += map(lambda _:_.fmtmm,  qf + tf )
00163 
00164         lbl  = map(lambda _:[_.lfmt] , xf + cf )
00165         lbl += map(lambda _:_.lmtmm,  qf + tf )
00166 
00167         scol = sum(col,[])
00168         sfld = sum(fld,[])
00169         sfmt = sum(fmt,[])
00170         slbl = sum(lbl,[])
00171 
00172         col = ",".join(scol)
00173         table = "%s"  # filled in the __call__
00174         sql = "select %(col)s from %(table)sVld group by %(gcol)s " % locals()
00175         log.info(sql)
00176 
00177         fld = " ".join(sfld)
00178         fmt = " ".join(sfmt)
00179         lbl = " ".join(slbl)
00180 
00181         self.sql = sql
00182         self.xcol = xcol
00183         self.fmt = fmt
00184         self.lbl = lbl
00185         self.fld = fld
00186 

Member Function Documentation

def vgroup::VGroup::populate (   self,
  arg 
)
Clear this dict and set contents from the `arg`

:param arg: either path to pickled obj OR pre-retrieved dict

Definition at line 187 of file vgroup.py.

00187                            : 
00188         """
00189         Clear this dict and set contents from the `arg`
00190 
00191         :param arg: either path to pickled obj OR pre-retrieved dict
00192         """
00193         self.clear()
00194         dod = arg if type(arg) == dict else Pickler.retrieve(arg)
00195         for k in dod:
00196             self[k] = dod[k]
00197 
def vgroup::VGroup::__call__ (   self,
  db,
  table 
)
Perform validity context group query, retaining 
results within this list of dict  

:param db: DB instance
:param table: payload table name

Definition at line 198 of file vgroup.py.

00199                                   :
00200         """
00201         Perform validity context group query, retaining 
00202         results within this list of dict  
00203 
00204         :param db: DB instance
00205         :param table: payload table name
00206         """
00207         for d in db(self.sql % table):
00208             key = tuple(map(lambda k:int(d[k]),self.xcol))
00209             self[key] = d

def vgroup::VGroup::persist (   self,
  path 
)
:param path: for pickling 

Definition at line 210 of file vgroup.py.

00211                            :
00212         """
00213         :param path: for pickling 
00214         """
00215         Pickler.persist(dict(self), path)

def vgroup::VGroup::tuple_keys (   self)

Definition at line 216 of file vgroup.py.

00217                         :
00218         return sorted(filter(lambda _:type(_)==tuple,self.keys()))

def vgroup::VGroup::column (   self,
  k 
)

Definition at line 219 of file vgroup.py.

00220                        :
00221         tks = self.tuple_keys()
00222         return map(lambda tk:self[tk][k], tks ) 

def vgroup::VGroup::__repr__ (   self)

Definition at line 223 of file vgroup.py.

00224                       :
00225         return "\n".join([self.lbl] + map(lambda k:self.fmt % self[k], self.tuple_keys() )  )
00226 
00227 
00228 


Member Data Documentation

Definition at line 137 of file vgroup.py.

Definition at line 137 of file vgroup.py.

Definition at line 137 of file vgroup.py.

Definition at line 137 of file vgroup.py.

Definition at line 137 of file vgroup.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:57:25 for DybDbi by doxygen 1.7.4