db.py 622 B

1234567891011121314151617181920212223242526272829303132333435
  1. import config
  2. import database
  3. import typer
  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 run(max: int = 5):
  12. batch_dir = cfg.system_dir + "\\SQL\\batch"
  13. database.run(batch_dir, max)
  14. @app.command()
  15. def schema():
  16. database.schema()
  17. @app.command()
  18. def bcp_log():
  19. logs_dir = cfg.system_dir + "\\SQL\\temp"
  20. output_file = cfg.log_dir + "\\bcp.csv.log"
  21. database.bcp_log(logs_dir, output_file)
  22. if __name__ == "__main__":
  23. app()