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

In This Package:

Classes | Functions | Variables
DybDbi::ilookup Namespace Reference

Classes

class  IEntry
class  ILookup
class  IRunLookup

Functions

def args_
def main
def check_irunlookup

Variables

tuple log = logging.getLogger(__name__)
tuple il = main()

Detailed Description

Perform multiple DBI lookups with a single DBI query...
Made possible by restrictions on the nature of the lookups. 

The canonical example is looking up entries in GDaqRunInfo based on the 
runNo field (RunNo attribute)


Function Documentation

def DybDbi::ilookup::args_ ( )

Definition at line 79 of file ilookup.py.

00080            :
00081     import argparse
00082 
00083     cls = IRunLookup
00084 
00085     ap = argparse.ArgumentParser(description=__doc__)
00086     ap.add_argument( 'iargs', nargs="+" , type=int,                help='One or more integer arguments to lookup ')
00087     ap.add_argument( '-k', '--kls',        default=cls.kls,        help='Name of DybDbi class. Default %(default)s ')
00088     ap.add_argument( '-d', '--ifield',     default=cls.ifield,     help='Payload integer fieldname corresponding to positional argument values. Default %(default)s ')
00089     ap.add_argument( '-s', '--sqlcontext', default=cls.sqlcontext, help='Extended query SQL context. Default %(default)s ')
00090     ap.add_argument( '-i', '--iattr',      default=cls.iattr,      help='DybDbi integer attribute name, used for the in memory lookup to arrange entries by argument. Default %(default)s ') 
00091 
00092     ap.add_argument(       '--dbconf',     default=None   ,       help='Name of section of ~/.my.cnf with DB connection parameters. Default %(default)s ')
00093     args = ap.parse_args()
00094     return args

def DybDbi::ilookup::main ( )

Definition at line 95 of file ilookup.py.

00096           :
00097     import os
00098     args = args_()
00099     if args.dbconf:
00100         os.environ['DBCONF'] = args.dbconf 
00101     il = ILookup( *args.iargs , kls=args.kls , ifield=args.ifield , iattr=args.iattr, sqlcontext=args.sqlcontext )
00102     for iarg in args.iargs:
00103         print iarg, il[iarg]
00104     return il

def DybDbi::ilookup::check_irunlookup ( )

Definition at line 105 of file ilookup.py.

00106                       :
00107     iargs = (10,100,1000)
00108     irl = IRunLookup( *iargs )
00109     for ia in iargs:
00110         print ia, irl[ia]
00111 


Variable Documentation

Definition at line 10 of file ilookup.py.

tuple DybDbi::ilookup::il = main()

Definition at line 113 of file ilookup.py.

| 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