38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""检查算法数据"""
|
|
|
|
import sys
|
|
import os
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
from app.models.database import SessionLocal
|
|
from app.models.models import Algorithm
|
|
|
|
def check_algorithms():
|
|
"""检查算法数据"""
|
|
db = SessionLocal()
|
|
|
|
try:
|
|
algorithms = db.query(Algorithm).all()
|
|
|
|
print(f"数据库中共有 {len(algorithms)} 个算法:\n")
|
|
|
|
for algo in algorithms:
|
|
print(f"算法名称: {algo.name}")
|
|
print(f" ID: {algo.id}")
|
|
print(f" 类型: {algo.type}")
|
|
print(f" 技术分类: {algo.tech_category}")
|
|
print(f" 输出类型: {algo.output_type}")
|
|
print(f" 描述: {algo.description}")
|
|
print(f" 状态: {algo.status}")
|
|
print(f" 版本数: {len(algo.versions)}")
|
|
print()
|
|
|
|
except Exception as e:
|
|
print(f"检查算法数据失败: {e}")
|
|
sys.exit(1)
|
|
finally:
|
|
db.close()
|
|
|
|
if __name__ == "__main__":
|
|
check_algorithms() |