c7.py 689 B

123456789101112131415161718192021222324252627282930
  1. import os
  2. from pathlib import Path
  3. import config
  4. import cognos7
  5. import typer
  6. app = typer.Typer()
  7. cfg = config.Config()
  8. @app.command()
  9. def iqd_convert():
  10. iqdconv = cognos7.IqdConverter()
  11. iqdconv.output_dir = cfg.system_dir + "\\SQL\\schema\\" + cfg.system + "\\views_imr"
  12. iqdconv.run_folder(cfg.system_dir + "\\IQD")
  13. @app.command()
  14. def mdl_convert(mdl_file):
  15. cognos7.convert_file(mdl_file)
  16. source = mdl_file[:-4] + ".json"
  17. target = cfg.cognos11.specs_dir + "/../DataModel/" + Path(source).name
  18. os.makedirs(os.path.dirname(target), exist_ok=True)
  19. Path(target).unlink(missing_ok=True)
  20. os.rename(source, target)
  21. if __name__ == "__main__":
  22. app()