Ejemplo n.º 1
0
 def __init__(self,opt,dbname,uname,pwd):
   # User deals with whatever db or files they choose-divorced 
   # from scoring engine proper.
   # For this particular application, a db instance was used.
   from runlib.any_db import ConnectFactory
   self.log=logging.getLogger('UserCode')
   DB=ConnectFactory(dbtype=opt.sql_db,execlog=opt.sql_log,logger=self.log)
   self.db=DB.connect(user=str(uname),passwd=str(pwd),db=dbname)
   self.cv=self.db.cursor()
Ejemplo n.º 2
0
    def __init__(self, opt, dbname, uname, pwd):
        # User deals with whatever db or files they choose-divorced
        # from scoring engine proper.
        # For this particular application, a db instance was used.
        from runlib.any_db import ConnectFactory

        self.log = logging.getLogger("UserCode")
        DB = ConnectFactory(dbtype=opt.sql_db, execlog=opt.sql_log, logger=self.log)
        self.db = DB.connect(user=str(uname), passwd=str(pwd), db=dbname)
        self.cv = self.db.cursor()
Ejemplo n.º 3
0
def userInitializeConfigs(bootstrapConfig,zero,configdir):
    """ This routine fills the database with configuration
        files for scoring operations.
    """
    user_config=Config(bootstrapConfig)
    dbname=user_config.get('database_name')
    uname=user_config.get('database_user')
    pwd=user_config.get('database_upwd')

    makeConfigTable(str(dbname),str(uname),str(pwd))

    DB=ConnectFactory(dbtype='MySQLdb',execlog='/tmp/sqllog')
    db=DB.connect(db=dbname,user=str(uname),passwd=str(pwd))
    cv=db.cursor()

    if (not zero):
        fillConfig(cv,configdir+'/'+'userConfig','Starting User Data Scoring Config File')
        fillConfig(cv,configdir+'/'+'scoringConfig','Starting config file use for internal maintenance of scoring')