single.get("tablelist")
上述获取的是一个列表list
一种比较恶心的办法,将list以字符串的形式拼接在SQL语句中
if "共享平台" in single.get("key"): sql = "select " "table_schema, " "table_name, " "table_comment, " "round(data_length/1024/1024, 2) as 'datasizeM', " "round(index_length/1024/1024, 2) as 'indexsizeM', " "table_rows as 'rows' " "from information_schema.tables " "where table_name in ("+str(single.get("tablelist")).split('[')[1].split(']')[0]+")" else:
如各位大侠有更好的办法,还请不吝赐教!