Esempio n. 1
0
def starun(startdate, enddate, model):
    info("starun:%s-%s,model[%s]" % (str(startdate), str(enddate), model))
    if model == None:
        etldate = startdate
        while int(etldate) <= int(enddate):
            ufoi.update_orgid(int(etldate), int(etldate))
            run_etl(etldate, etldate)
            etldate = daycalc(etldate, 1)
        uhb.del_dup()
        uhb.insert_miss(int(enddate), '存款')  #补齐正常数据
        uhb.insert_miss(int(enddate), '理财')  #补齐正常数据
        uhb.insert_miss_percentage(int(enddate), '存款')  #补齐正常分润数据
        uhb.insert_miss_percentage(int(enddate), '理财')  #补齐正常分润数据
        uhb.update_balance(int(enddate))
        util.fix_seq_id('D_MANAGE', 'D_MANAGE_SEQ')
    else:
        etldate = startdate
        while int(etldate) <= int(enddate):
            run_etl(etldate, etldate, model)
            etldate = daycalc(etldate, 1)
        util.fix_seq_id('D_MANAGE', 'D_MANAGE_SEQ')
Esempio n. 2
0
        db.conn.commit()
    finally:
        db.closeDB()


if __name__ == '__main__':
    arglen = len(sys.argv)
    if arglen == 2:
        filename = sys.argv[1]
        print filename
        filelist = [
            x for x in os.listdir(filename)
            if os.path.splitext(x)[1].find('xls')
        ]
        print "begin:", str(datetime.datetime.now())
        for filepath in filelist:
            if 'svn' not in filepath:
                print filepath
                run_import(filename + filepath)
        uhb.del_dup()
        print "end:", str(datetime.datetime.now())
    elif arglen == 3:
        filename = sys.argv[1]
        orgcode = sys.argv[2]
        print "begin:", str(datetime.datetime.now())
        run_import(filename, orgcode)
        uhb.del_dup()
        print "end:", str(datetime.datetime.now())
    else:
        print "please input python import_hook.py [filename] [hooktype]"