def update(**kwargs): data = kwargs.get('data', {}) where = kwargs.get('where', {}) check_update_params(Idc, data, where) ret = db.session.query(Idc).filter_by(**where).update(data) db.session.commit() return ret
def update(**kwargs): data = kwargs.get('data', {}) where = kwargs.get('where', {}) check_update_params(Supplier, data, where) ret = db.session.query(Supplier).filter_by(**where).update(data) try: db.session.commit() except Exception,e: raise Exception(e.message.split(") ")[1])
def update(**kwargs): data = kwargs.get("data", {}) where = kwargs.get("where", {}) check_update_params(Product, data, where) ret = db.session.query(Product).filter_by(**where).update(data) try: db.session.commit() except Exception, e: current_app.logger.warning("commit error:{}".format(e.message)) raise Exception("commit error")
def update(**params): data = params.get('data',{}) where = params.get('where',{}) check_update_params(Idc,data,where) ret = db.session.query(Idc).filter_by(**where).update(data) try: db.session.commit() except Exception,e: print e.message.split()[1] raise Exception(e.message.split(") ")[1])
def update(**kwargs): data = kwargs.get("data", {}) where = kwargs.get("where", {}) check_update_params(Cabinet, data, where) ret = db.session.query(Cabinet).filter_by(**where).update(data) try: db.session.commit() except Exception, e: current_app.logger.warning("commit error:{}".format(e.message)) raise Exception("commit error")
def update(**params): data = params.get('data',{}) where = params.get('where',{}) check_update_params(Status,data,where) ret = db.session.query(Status).filter_by(**where).update(data) try: db.session.commit() except Exception,e: print e.message.split()[1] raise Exception(e.message.split(") ")[1])
def update(**kwargs): data = kwargs.get('data', {}) where = kwargs.get('where', {}) check_update_params(IpInfo, data, where) if data.get("server_id", None): check_value_exists(Server, "id", kwargs.get("server_id", None)) if data.get("switch_id", None): check_value_exists(Switch, "id", kwargs.get("switch_id", None)) ret = db.session.query(IpInfo).filter_by(**where).update(data) db.session.commit() return ret
def update(**kwargs): data = kwargs.get('data', {}) where = kwargs.get('where', {}) print data print where #验证传入的信息 check_update_params(Raid, data, where) ret = db.session.query(Raid).filter_by(**where).update(data) try: db.session.commit() except Exception, e: raise Exception(e.message.split(") ")[1])
def update(**params): data = params.get('data',{}) where = params.get('where',{}) check_update_params(Cabinet,data,where) check_value_exists(Idc,"id",params.get("idc_id",None)) check_value_exists(Power,"server_power",params.get("power",None)) ret = db.session.query(Cabinet).filter_by(**where).update(data) try: db.session.commit() except Exception,e: print e.message.split()[1] raise Exception(e.message.split(") ")[1])
def update(**kwargs): data = kwargs.get('data', {}) where = kwargs.get('where', {}) print data print where #验证传入的信息 check_update_params(Manufacturers, data, where) ret = db.session.query(Manufacturers).filter_by(**where).update(data) try: db.session.commit() except Exception,e: raise Exception(e.message.split(") ")[1])
def update(**kwargs): data = kwargs.get("data", {}) where = kwargs.get("where", {}) # # 1 验证data # # 2 验证where # # 3 更新必须提供id,只按照id更新 # # id 要为数字且大于0的整数 check_update_params(RaidType, data, where) # update ret = db.session.query(RaidType).filter_by(**where).update(data) try: db.session.commit() except Exception, e: # logging current_app.logger.warning("commit error: {}".format(e.message)) raise Exception("commit error")
def update(**kwargs): data = kwargs.get("data", {}) where = kwargs.get("where", {}) # # 1 验证data # # 2 验证where # # 3 更新必须提供id,只按照id更新 # # id 要为数字且大于0的整数 check_update_params(Product, data, where) # update ret = db.session.query(Product).filter_by(**where).update(data) try: db.session.commit() except Exception, e: # logging current_app.logger.warning("commit error: {}".format(e.message)) raise Exception("commit error")
def update(**kwargs): data = kwargs.get("data", {}) where = kwargs.get("where", {}) # # 1 验证data # # 2 验证where # # 3 更新必须提供id,只按照id更新 # # id 要为数字且大于0的整数 check_update_params(Manufacturers, data, where) # update # ret = db.session.query(Manufacturers).filter_by(**where).update(**data) # 调用模块执行出现错误:update() got an unexpected keyword argument 'rel_cabinet_num' ret = db.session.query(Manufacturers).filter_by(**where).update(data) try: db.session.commit() except Exception, e: # logging current_app.logger.warning("commit error: {}".format(e.message)) raise Exception("commit error")
def update(**kwargs): data = kwargs.get("data", {}) where = kwargs.get("where", {}) # # 1 验证data # if not data: # raise Exception("data为空,没有需要更新的") # # for field in data.keys(): # if not hasattr(Idc, field): # raise Exception("需要更新的 {} 字段在idc表不存在".format(field)) # # # 2 验证where # if not where: # raise Exception("需要提供where条件") # # # 3 更新必须提供id,只按照id更新 # if not where.get("id", None): # raise Exception("需要提供id作为更新条件") # # # id 要为数字且大于0的整数 # if str(where.get("id")).isdigit(): # if int(where.get("id")) <= 0: # raise Exception("id的值为大于0的整数") # else: # raise Exception("条件中的id必须为数字") check_update_params(Idc, data, where) # update # ret = db.session.query(Idc).filter_by(**where).update(**data) # 调用模块执行出现错误:update() got an unexpected keyword argument 'rel_cabinet_num' ret = db.session.query(Idc).filter_by(**where).update(data) try: db.session.commit() except Exception, e: # logging current_app.logger.warning("commit error: {}".format(e.message)) raise Exception("commit error")
def update(**kwargs): data = kwargs.get("data", {}) where = kwargs.get("where", {}) # # 1 验证data # if not data: # raise Exception("data为空,没有需要更新的") # # for field in data.keys(): # if not hasattr(Idc, field): # raise Exception("需要更新的 {} 字段在idc表不存在".format(field)) # # # 2 验证where # if not where: # raise Exception("需要提供where条件") # # # 3 更新必须提供id,只按照id更新 # if not where.get("id", None): # raise Exception("需要提供id作为更新条件") # # # id 要为数字且大于0的整数 # if str(where.get("id")).isdigit(): # if int(where.get("id")) <= 0: # raise Exception("id的值为大于0的整数") # else: # raise Exception("条件中的id必须为数字") check_update_params(Idc, data, where) # update # ret = db.session.query(Idc).filter_by(**where).update(**data) # 调用模块执行出现错误:update() got an unexpected keyword argument 'rel_cabinet_num' ret = db.session.query(Idc).filter_by(**where).update(data) try: db.session.commit() except Exception, e: # logging current_app.logger.warning("commit error: {}".format(e.message)) raise Exception("commit error")