import pandas as pd
from sqlalchemy import create_engine

# 创建示例DataFrame
data = {'column1': [1, 2, 3], 'column2': ['a', 'b', 'c']}
df = pd.DataFrame(data)

# 数据库连接字符串
database_url = 'mysql+pymysql://test_pldb_rw:fbtYqZ0I4YszvFEjaKZuoTXCM77uP2@test-scrm-cluster.rwlb.rds.aliyuncs.com/ai'
engine = create_engine(database_url)

# 将DataFrame写入MySQL
table_name = 'your_table_name'
df.to_sql(table_name, con=engine, index=False, if_exists='append')