就是拼一个跟新sql语句 想用lambda简化代码,拼不明白了 可以传入个数组[]
sql = """ """ if schedule != None: sql = sql + "schedule = %s " % schedule if status != None: sql = sql + " , status = %s" % status if resultfilepath != None: sql = sql + """ , resultfilepath = "%s" """ % resultfilepath if infofilepath != None: sql = sql + """ , infofilepath = "%s" """ % infofilepath if info != None: sql = sql + """ , info = "%s" """ % info sqls = """update information.plan set %s where pid = %s ;""" % (sql, pid)
目的就是 set 后面的站位符 比如我想跟新一个字段 他就直接给我拼一个值,如果两个就 比如 set aa=1,bb=2 where ....