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:

 

 

如各位大侠有更好的办法,还请不吝赐教!

 

相关文章:

  • 2021-10-24
  • 2022-01-28
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2022-02-11
猜你喜欢
  • 2022-02-09
  • 2021-10-07
  • 2021-11-22
  • 2022-01-19
  • 2022-12-23
  • 2021-12-23
相关资源
相似解决方案