#!/usr/bin/env python #-*- coding: ISO-8859-1 -*- # # Author: Valentin Kuznetsov, Cornell University, 2006 # # system modules import sys, string, time, types #import sqlalchemy.mods.threadlocal from sqlalchemy import * # DBS modules from DDConfig import * ddConfig = DDConfig() useEngine = ddConfig.engine() verbose = ddConfig.verbose() user = ddConfig.user() password = ddConfig.password() dbname = ddConfig.dbname() if useEngine=='sqlite': print "Use SQLite engine for Data Discovery history" engine = create_engine('sqlite:///sqlite.db') elif useEngine=='oracle': print "Use ORACLE engine for Data Discovery history" engine = create_engine('oracle://%s:%s@cms_dbs'%(user,password),strategy='threadlocal',threaded=True) elif useEngine=='mysql': print "Use MySQL engine for Data Discovery history" engine = create_engine('mysql://%s:%s@localhost/%s'%(user,password,dbname),strategy='threadlocal') else:
# import system modules import string, os, sys, stat, shutil # DBS modules import DDHelper, DBSInst, DDUtil from DDOptions import * from DDConfig import * from DDExceptions import * # # main # if __name__ == "__main__": optManager = DDOptionParser('DDHelper') (opts,args) = optManager.getOpt() ddConfig = DDConfig() iface = ddConfig.iface() if opts.iface: iface=opts.iface helper = DDHelper.DDHelper(iface=iface) if opts.quiet: helper.setQuiet() if opts.dbsInst: if not DBSInst.DBS_DLS_INST.has_key(opts.dbsInst): print "Wrong DBS instances '%s'"%opts.dbsInst DDUtil.printListElements(DBSInst.DBS_DLS_INST.keys(),"Known DBS instances") sys.exit(1) for dbsInst in DBSInst.DBS_DLS_INST.keys(): if opts.dbsInst: if dbsInst!=opts.dbsInst: continue