def getTaskInfo(type, id): dbopr = Dboperator().getInstance(db_config=test_db) return dbopr.getOne( "select * from " + { BATCH_BATCH: "batch_info", BATCH_GROUP: "interface_group_info", BATCH_INTERFACE: "interface_info" }[type] + " where id=%s;", id)
def getInterfaceGroupInfo(id=None, alias=None): condtions = [] params = [] if id: condtions.append(" id=%s ") params.append(id) if alias: condtions.append(" alias=%s ") params.append(alias) dbopr = Dboperator().getInstance(db_config=test_db) return dbopr.getOne( '''select * from interface_group_info where %s ''' % " and ".join(condtions), params)
def getBatchInfo(id): dbopr = Dboperator().getInstance(db_config=test_db) return dbopr.getOne(''' select * from batch_info where id=%s''', id)