debug: 创建生成后查询测试脚本
为了准确定位 file_path 为 null 的问题,创建了 test_after_generate.py 测试脚本。 脚本功能: - 直接查询数据库中的历史记录 - 显示最近5条记录的 file_path 值 - 显示 file_path 的类型 运行方式: ```bash python test_after_generate.py ``` 这个测试会绕过API,直接查看数据库中的实际数据,帮助定位问题。 Coze-Commit-Type: user Coze-User-ID: 3722323274763196 Coze-Conversation-ID: 9894087
This commit is contained in:
BIN
assets/image_20260709134736595.png
Normal file
BIN
assets/image_20260709134736595.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
55
test_after_generate.py
Normal file
55
test_after_generate.py
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
测试生成日报后 file_path 是否正确保存
|
||||
"""
|
||||
import sys
|
||||
sys.path.insert(0, '/workspace/projects')
|
||||
|
||||
import pymysql
|
||||
|
||||
# 数据库连接
|
||||
conn = pymysql.connect(
|
||||
host='haoslm2.xicp.net',
|
||||
port=10216,
|
||||
user='root',
|
||||
password='DsideaL147258369',
|
||||
database='yltcharge',
|
||||
charset='utf8mb4'
|
||||
)
|
||||
|
||||
cursor = conn.cursor()
|
||||
|
||||
print("=" * 60)
|
||||
print("测试生成日报后 file_path 保存情况")
|
||||
print("=" * 60)
|
||||
|
||||
# 查询最近的历史记录
|
||||
cursor.execute("""
|
||||
SELECT id, report_date, split_name, file_path, status, create_time
|
||||
FROM t_daily_report_history
|
||||
ORDER BY create_time DESC
|
||||
LIMIT 5
|
||||
""")
|
||||
|
||||
rows = cursor.fetchall()
|
||||
|
||||
print(f"\n最近 {len(rows)} 条历史记录:\n")
|
||||
|
||||
for row in rows:
|
||||
id, report_date, split_name, file_path, status, create_time = row
|
||||
print(f"ID: {id}")
|
||||
print(f" 日期: {report_date}")
|
||||
print(f" 名称: {split_name}")
|
||||
print(f" file_path: {file_path}")
|
||||
print(f" file_path类型: {type(file_path)}")
|
||||
print(f" status: {status}")
|
||||
print(f" 创建时间: {create_time}")
|
||||
print()
|
||||
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
print("=" * 60)
|
||||
print("测试完成")
|
||||
print("=" * 60)
|
||||
Reference in New Issue
Block a user