调整数据库为wzxphoto

This commit is contained in:
2024-05-27 16:53:24 +08:00
parent 8f89fe50df
commit 48cede5427
6 changed files with 43 additions and 18 deletions

View File

@@ -3,12 +3,13 @@ import subprocess
from config.mysql import DB_URL
table = input("请输入表名:")
out_file = f"photo_review/entity/{table}.py"
command = f"sqlacodegen {DB_URL} --outfile={out_file} --tables={table}"
if __name__ == '__main__':
table = input("请输入表名:")
out_file = f"photo_review/entity/{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的声明")
except Exception as e:
print(f"生成{table}.py文件时发生错误: {e}")
try:
subprocess.run(command, shell=True, check=True)
print(f"{table}.py文件生成成功请手动调整Base的声明")
except Exception as e:
print(f"生成{table}.py文件时发生错误: {e}")