Reapply "整理项目结构,优化配置项"

This reverts commit 2f650dd880.
This commit is contained in:
2024-07-15 15:20:52 +08:00
parent 2f650dd880
commit f4a2a38df0
33 changed files with 275 additions and 506 deletions

View File

@@ -1,15 +1,15 @@
# 自动生成数据库表和sqlalchemy对应的Model
import subprocess
from config.mysql import DB_URL
from db import DB_URL
if __name__ == '__main__':
table = input("请输入表名:")
out_file = f"photo_review/entity/{table}.py"
out_file = f"db/{table}.py"
command = f"sqlacodegen {DB_URL} --outfile={out_file} --tables={table}"
try:
subprocess.run(command, shell=True, check=True)
print(f"{table}.py文件生成成功手动调整Base的声明")
print(f"{table}.py文件生成成功检查并复制到合适的文件中")
except Exception as e:
print(f"生成{table}.py文件时发生错误: {e}")