Files
test-mcp/clear_test_db.py
2026-06-19 16:26:09 +09:00

30 lines
909 B
Python

import pymysql
import os
from dotenv import load_dotenv
load_dotenv()
def clear_project_history():
conn = pymysql.connect(
host=os.getenv('DB_HOST', 'localhost'),
user=os.getenv('DB_USER', 'root'),
password=os.getenv('DB_PASSWORD', '45278434'),
database='PM_proto_test',
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor
)
try:
with conn.cursor() as cursor:
# 테이블의 모든 데이터를 삭제
print("Cleaning projects_history table in PM_proto_test...")
cursor.execute("DELETE FROM projects_history")
conn.commit()
print("Successfully cleared all records from projects_history.")
except Exception as e:
print(f"Error occurred: {e}")
finally:
conn.close()
if __name__ == "__main__":
clear_project_history()