/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
DybDbi::ilookup::ILookup Class Reference
Inheritance diagram for DybDbi::ilookup::ILookup:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__

Detailed Description

Example of use::

   il = ILookup( 10,100,1000, kls='GDaqRunInfo', ifield="runNo", iattr="RunNo" )
      #  corresponds to datasql WHERE clause :   runNo in (10,100,1000)
   print il[10]


The positional arguments are used in datasql **IN** list, the query must result in
the same number of entries as positional arguments.
The ``iattr`` is needed as DybDbi attribute names are often different from fieldnames, this
is used after the query with in memory lookup to arrange the results of the query by the argument
values.

Effectively the positional arguments must behave like primary keys with each arg 
corresponding to one row. 

Definition at line 19 of file ilookup.py.


Constructor & Destructor Documentation

def DybDbi::ilookup::ILookup::__init__ (   self,
  args,
  kwa 
)

Reimplemented in DybDbi::ilookup::IRunLookup.

Definition at line 38 of file ilookup.py.

00039                                       :
00040         dict.__init__(self) 
00041 
00042         import DybDbi
00043         kls = getattr( DybDbi, kwa['kls'] ) 
00044         rpt = kls.Rpt()
00045 
00046         if len(args) > 1: 
00047             datasql = "%s in %s" % ( kwa['ifield'], str(tuple(args)) )
00048         else:
00049             datasql = "%s = %s" % ( kwa['ifield'], args[0] ) 
00050 
00051         rpt.ctx( sqlcontext=kwa['sqlcontext'] , datasql=datasql , task=-1, subsite=-1 )
00052         if len(rpt) < len(args):
00053            log.warn("failed to lookup and entry for every argument ... trouble ahead " )
00054 
00055         for arg in args:
00056             row = rpt.FirstRowWithIntValueForKey( kwa['iattr'] , arg )
00057             assert row, "Failed to find %s entry with arg %s using iattr %s " % ( kwa['kls'] , arg, kwa['iattr'] )
00058             self[arg] = IEntry( row, rpt.GetValidityRec(row) )
00059 


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:24 for DybDbi by doxygen 1.7.4