import pymysql from pathlib import Path sql_path = Path(r"d:/Projects/Ai-DOP/SourceCode/ai-dop-platform/docs/db/V1__aidopcore_all_tables.sql") sql = sql_path.read_text(encoding='utf-8').replace('\n ,key ', '\n key ') conn = pymysql.connect( host='123.60.180.165', port=3306, user='aidopremote', password='1234567890aiDOP#', charset='utf8mb4', autocommit=True, ) try: with conn.cursor() as cur: statements = [s.strip() for s in sql.split(';') if s.strip()] ok = 0 for st in statements: cur.execute(st) ok += 1 cur.execute("SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='aidopdev'") table_count = cur.fetchone()[0] print(f"Applied statements: {ok}") print(f"aidopdev tables: {table_count}") finally: conn.close()