cubewise-code / tm1py

TM1py is a Python package that wraps the TM1 REST API in a simple to use library.
http://tm1py.readthedocs.io/en/latest/
MIT License
188 stars 107 forks source link

Git Integration (Control Objects) #520

Closed harveyca307 closed 3 years ago

harveyca307 commented 3 years ago

Describe what did you try to do with TM1py Testing script to enable Git integration for TM1 environment using git.push and git.pull

Describe what's not working the way you expect Didn't get the expected result? Describe:

  1. Expected Control Objects to get pushed to repository
  2. Reading @ykud articles on enabling Git and trying to write Python Script to enable "hot" migrations, I am missing the piece where the plan is created to what to push (https://www.ykud.com/blog/cognos/tm1-cognos/git-integration-for-tm1-part-2/).
  3. I pushed a TM1 database to Git in a branch called prod., I then tried to pull it to a blank instance and received errors about Control object being missing. @ykud and @scrumthing answered my original question about how to set this up...Much appreciated
  4. How to I enable a push of Control Object using TM1Service?

Version

Additional context Sample Code:

def push(init: bool, instance: str):
    try:
        with TM1Service(**config[instance]) as tm1:
            if init:
                tm1.git.git_init(git_url=url,
                                 deployment="dev",
                                 username=git_user,
                                 password=git_password,
                                 force=True)
            tm1.git.git_push(branch='Prod', force=True,
                             username=git_user,
                             password=git_password,
                             message='Test Push from TM1Py',
                             author=git_author,
                             email=git_email,
                             execute=True)
        return True
    except TM1pyException as e:
        print(e)
        return False
scrumthing commented 3 years ago

The tm1project file is not part of tm1py yet. Feel free to make a pull request. :-) There is no nice way for pushing control objects and I fear there never will be. In the long run the easiest way might be to write every change for a control object as TI code. :-/ Maintaining a tm1project file will be a constant effort because you have to add every new attribute cube and dimension and aliases are not part of the git metadata model (meaning they will be pushed as numeric elements).

harveyca307 commented 3 years ago

Thank you for the feedback. Will look to use the RestAPI directly to "hot promote" objects