import pymysql conn = pymysql.connect(host='lb-6apeo86d-n9wuz4o8bvyxdrl0.clb.sh-tencentclb.net', port=9030, user='yinzhou', password='cyLcVgNY!jeQ5zL', db='sdk_statis') cursor = conn.cursor() cursor.execute("SHOW TABLES") tables = [row[0] for row in cursor.fetchall()] for table in tables: if 'dwd_active_role' != table: cursor.execute(f"SHOW CREATE TABLE {table}") create_sql = cursor.fetchone()[1] # print(f"{table};") print(f"drop TABLE {table};") print(create_sql)