db.py 776 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import typer
  2. import config
  3. import database
  4. app = typer.Typer()
  5. cfg = config.Config()
  6. @app.command()
  7. def create(config_file: str):
  8. config_file = cfg.system_dir + f"\\SQL\\config\\{config_file}.json"
  9. database.create(config_file)
  10. @app.command()
  11. def compare(config_file: str):
  12. config_file = cfg.system_dir + f"\\SQL\\config\\{config_file}.json"
  13. database.compare(config_file)
  14. @app.command()
  15. def run(max: int = 5):
  16. batch_dir = cfg.system_dir + "\\SQL\\batch"
  17. database.run(batch_dir, max)
  18. @app.command()
  19. def schema():
  20. database.schema()
  21. @app.command()
  22. def bcp_log():
  23. logs_dir = cfg.system_dir + "\\SQL\\temp"
  24. output_file = cfg.log_dir + "\\bcp.csv.log"
  25. database.bcp_log(logs_dir, output_file)
  26. if __name__ == "__main__":
  27. app()