good version for 算法注册
This commit is contained in:
38
backend/check_algorithms.py
Normal file
38
backend/check_algorithms.py
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/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()
|
||||
Reference in New Issue
Block a user