TM1py and python integration with TM1
-
- Posts: 28
- Joined: Wed Jan 18, 2017 3:27 pm
- OLAP Product: Cognos TM1
- Version: 10.2.2, 11
- Excel Version: Excel2010
- Location: Bangalore, India
TM1py and python integration with TM1
Hi Everyone,
This is a general question regarding TM1 and python integration. I have recently started exploring TM1py library and based on sample codes what I could understand is that it is used for creating dim, subsets, cube , perform CRUD operations etc. What is unclear to me is that when we can do all these operations from TM1 architect or PAW, what is the use of python integration? Maybe there is a broader picture of this which I am unable to see for now and would like your expertise on below questions:
1. Why use python with TM1?
2. What are the benefits we get which we are unble to get so far with existing TM1 tools?
3. How to best use python in existing tm1 models?
4. What is the future of TM1 and python integration?
5. Has anyone used ML on top of TM1 so far? If yes, could you please share some insights how we can start doing so?
Looking forward to hear from you!
This is a general question regarding TM1 and python integration. I have recently started exploring TM1py library and based on sample codes what I could understand is that it is used for creating dim, subsets, cube , perform CRUD operations etc. What is unclear to me is that when we can do all these operations from TM1 architect or PAW, what is the use of python integration? Maybe there is a broader picture of this which I am unable to see for now and would like your expertise on below questions:
1. Why use python with TM1?
2. What are the benefits we get which we are unble to get so far with existing TM1 tools?
3. How to best use python in existing tm1 models?
4. What is the future of TM1 and python integration?
5. Has anyone used ML on top of TM1 so far? If yes, could you please share some insights how we can start doing so?
Looking forward to hear from you!
Regards,
Amit Saxena
India
Amit Saxena
India
-
- Site Admin
- Posts: 1457
- Joined: Wed May 28, 2008 9:09 am
Re: TM1py and python integration with TM1
My take on your questions:
1. Why use python with TM1?
To do something you can't do with the builtin tools
2. What are the benefits we get which we are unable to get so far with existing TM1 tools?
Integration:
If you don't have a need, don't bother. All you need to do is to set /check the HTTPPortNumber in tm1s.cfg.
4. What is the future of TM1 and python integration?
Bright (IMO). Mariusz and Cubewise have done an excellent job and continue to support it (last update on 12 June 2020).
5. Has anyone used ML on top of TM1 so far? If yes, could you please share some insights how we can start doing so?
Don't know (assuming ML = Machine Learning?). Covered by 2 above I suspect.
1. Why use python with TM1?
To do something you can't do with the builtin tools
2. What are the benefits we get which we are unable to get so far with existing TM1 tools?
Integration:
- With Python libraries for functionality which is not in TM1 - eg IRR, stats
- With other products, via their Rest APIs
- With multiple TM1 instances
If you don't have a need, don't bother. All you need to do is to set /check the HTTPPortNumber in tm1s.cfg.
4. What is the future of TM1 and python integration?
Bright (IMO). Mariusz and Cubewise have done an excellent job and continue to support it (last update on 12 June 2020).
5. Has anyone used ML on top of TM1 so far? If yes, could you please share some insights how we can start doing so?
Don't know (assuming ML = Machine Learning?). Covered by 2 above I suspect.
- scrumthing
- Posts: 81
- Joined: Tue Jan 26, 2016 4:18 pm
- OLAP Product: TM1
- Version: 11.x
- Excel Version: MS365
Re: TM1py and python integration with TM1
Just to show some use cases we had so far.
We had to do a license audit and needed to provide the users for all of our tm1 instances. We have about 80 instances on 30-40 servers. Utilizing tm1py I wrote a script that logged into every instance and returned a list of users and their type via the rest api. License audit done in about 5 minutes. Try doing that any other way!
Another use case I am currently working on. Provide tm1 data for our internal data lake. We could of course export a csv file to import into the data lake. But with tm1py the data lake team can use their existing knowledge of python to extract the data whenever they have a need for an update and do not rely on someone in the tm1 team to trigger the export for them. They can easily extract all necessary metadata with one or two lines of code.
Of course you can do machine learning and that kind of stuff. If you need further information try www.nicholasrenotte.com. He is a data scientist at IBM and does some awesome stuff with tm1, python and weird data science stuff.![Smile :-)](./images/smilies/icon_e_smile.gif)
Hope that helps...
We had to do a license audit and needed to provide the users for all of our tm1 instances. We have about 80 instances on 30-40 servers. Utilizing tm1py I wrote a script that logged into every instance and returned a list of users and their type via the rest api. License audit done in about 5 minutes. Try doing that any other way!
Another use case I am currently working on. Provide tm1 data for our internal data lake. We could of course export a csv file to import into the data lake. But with tm1py the data lake team can use their existing knowledge of python to extract the data whenever they have a need for an update and do not rely on someone in the tm1 team to trigger the export for them. They can easily extract all necessary metadata with one or two lines of code.
Of course you can do machine learning and that kind of stuff. If you need further information try www.nicholasrenotte.com. He is a data scientist at IBM and does some awesome stuff with tm1, python and weird data science stuff.
![Smile :-)](./images/smilies/icon_e_smile.gif)
Hope that helps...
There is no OLAP database besides TM1!
-
- MVP
- Posts: 3667
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: TM1py and python integration with TM1
External system pulls can of course be a little risky without some rules of engagement as administrators (and users) of external systems are unlikely to be aware of (or care about) peak load times in the TM1 system(s) and often such external queries are by their nature large and resource intensive.scrumthing wrote: ↑Mon Jun 15, 2020 10:36 am Another use case I am currently working on. Provide tm1 data for our internal data lake. We could of course export a csv file to import into the data lake. But with tm1py the data lake team can use their existing knowledge of python to extract the data whenever they have a need for an update and do not rely on someone in the tm1 team to trigger the export for them. They can easily extract all necessary metadata with one or two lines of code.
(Quite off the main topic here but I thought relevant to point out).
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
- scrumthing
- Posts: 81
- Joined: Tue Jan 26, 2016 4:18 pm
- OLAP Product: TM1
- Version: 11.x
- Excel Version: MS365
Re: TM1py and python integration with TM1
Not at all off topic but instead very important. We currently solved that by providing native view for the export. That way we can control the amount of data. Of course there is no way stopping all the million stupid ways people can circumvent that.lotsaram wrote: ↑Mon Jun 15, 2020 1:23 pm External system pulls can of course be a little risky without some rules of engagement as administrators (and users) of external systems are unlikely to be aware of (or care about) peak load times in the TM1 system(s) and often such external queries are by their nature large and resource intensive.
(Quite off the main topic here but I thought relevant to point out).
![Smile :-)](./images/smilies/icon_e_smile.gif)
But the amount of data can definitely be an issue. That is why I try to figure out a way of pagination. But that as well can only prevent some of the possible cases in that area.
So thanks @lotsofram for bringing that up. Was thinking about restricting the service user for accessing the export to certain hours during the night. Otherwise no read access. But I have to think more about that.
There is no OLAP database besides TM1!
-
- MVP
- Posts: 3128
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.0.9.18
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: TM1py and python integration with TM1
In order to boost the adoption of tm1py and Python in cooperation with TM1, maybe it would be good to post some parts of what you used in the “Useful code, tips and tricks” subforum. Of course, anonymous data and names and such.scrumthing wrote: ↑Mon Jun 15, 2020 10:36 am Just to show some use cases we had so far.
We had to do a license audit and needed to provide the users for all of our tm1 instances. We have about 80 instances on 30-40 servers. Utilizing tm1py I wrote a script that logged into every instance and returned a list of users and their type via the rest api. License audit done in about 5 minutes. Try doing that any other way!
Another use case I am currently working on. Provide tm1 data for our internal data lake. We could of course export a csv file to import into the data lake. But with tm1py the data lake team can use their existing knowledge of python to extract the data whenever they have a need for an update and do not rely on someone in the tm1 team to trigger the export for them. They can easily extract all necessary metadata with one or two lines of code.
Best regards,
Wim Gielis
IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- Posts: 139
- Joined: Tue May 21, 2019 3:33 pm
- OLAP Product: TM1
- Version: PA 2.0.x
- Excel Version: 2016
- Location: The Internet
Re: TM1py and python integration with TM1
I just saw on Linked In that Cubewise are doing a Webinar about the Top 5 use cases of tm1py on June 18th, 2020. You should take a look !amit_hhh wrote: ↑Mon Jun 15, 2020 6:00 am 1. Why use python with TM1?
2. What are the benefits we get which we are unble to get so far with existing TM1 tools?
3. How to best use python in existing tm1 models?
4. What is the future of TM1 and python integration?
5. Has anyone used ML on top of TM1 so far? If yes, could you please share some insights how we can start doing so?
https://app.livestorm.co/cubewise-austr ... s-of-tm1py
If you can't watch it live, simply register and you'll be able to watch it whenever you want.
Enjoy !
-
- Site Admin
- Posts: 1457
- Joined: Wed May 28, 2008 9:09 am
Re: TM1py and python integration with TM1
I've discussed this somewhat with Mariusz and I believe his initial preference was for 'hints and tips' to be posted on the TM1PY GitHub as 'issues'. I am not myself convinced that this is sensible and indeed I posted something myself on this forum's hints and tips about using TM1PY to manage ODBCOutput passwords (which ykud more or less demolished, but heyWim Gielis wrote: ↑Mon Jun 15, 2020 4:34 pm In order to boost the adoption of tm1py and Python in cooperation with TM1, maybe it would be good to post some parts of what you used in the “Useful code, tips and tricks” subforum. Of course, anonymous data and names and such.
![Smile :)](./images/smilies/icon_e_smile.gif)
My current 'hints and tips' would be:
- Executing 'loose TI' statements actually creates/executes/deletes a process - no problem but you thus have to run it as admin;
- I had a (python) memory error writing a large cellset and found a simple pythonic way to split the cellset:
Code: Select all
Cellsetsize = len(Cellset)//2 Cellset1 = dict(list(Cellset.items())[Cellsetsize:]) tm1.cubes.cells.write_values(cubename,Cellset1,dimensions = dims) Cellset2 = dict(list(Cellset.items())[:Cellsetsize]) tm1.cubes.cells.write_values(cubename,Cellset2,dimensions = dims)
Re: TM1py and python integration with TM1
Let's hijack this thread a bit ![Smile :)](./images/smilies/icon_e_smile.gif)
I think tm1py-samples is indeed a reasonable repo for 'how to do X with tm1py' discussions and inclusion of some code samples, but I think there are a lot fewer people there than here, so maybe it should be the other way around ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
Have a look at tm1cmp if you haven't already (I need to write a post about it), it has an ability to define your view as MDX or a full spec in JSON file as well that you can re-use?scrumthing wrote: ↑Mon Jun 15, 2020 4:29 pm Not at all off topic but instead very important. We currently solved that by providing native view for the export. That way we can control the amount of data. Of course there is no way stopping all the million stupid ways people can circumvent that.![]()
You can use the $top=n in Rest API to return up to n records. You can see this implemented in the execute_set_mdx method in tm1py .scrumthing wrote: ↑Mon Jun 15, 2020 4:29 pm But the amount of data can definitely be an issue. That is why I try to figure out a way of pagination. But that as well can only prevent some of the possible cases in that area.
I didn't mean toDavid Usherwood wrote: ↑Mon Jun 15, 2020 10:03 pm I am not myself convinced that this is sensible and indeed I posted something myself on this forum's hints and tips about using TM1PY to manage ODBCOutput passwords (which ykud more or less demolished, but hey).
![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
- scrumthing
- Posts: 81
- Joined: Tue Jan 26, 2016 4:18 pm
- OLAP Product: TM1
- Version: 11.x
- Excel Version: MS365
Re: TM1py and python integration with TM1
Yeah, let us do this.
![Smile :-)](./images/smilies/icon_e_smile.gif)
I will do when it is working properly. But the one for usermanagement is rather simple. Don't know if it is worth it.Wim Gielis wrote: ↑Mon Jun 15, 2020 4:34 pm In order to boost the adoption of tm1py and Python in cooperation with TM1, maybe it would be good to post some parts of what you used in the “Useful code, tips and tricks” subforum. Of course, anonymous data and names and such.
Code: Select all
users = tm1.security.get_all_users
for x in users():
print(x._name + ';' + str(x._user_type )+ ';' + str(x._enabled ))
Yes but it was missing the SKIP parameter. But I already contacted Marius about it and (as always) he was so unbelievable fast in implementing it that you can already test it: https://github.com/cubewise-code/tm1py/pull/252
There is no OLAP database besides TM1!
-
- Posts: 28
- Joined: Wed Jan 18, 2017 3:27 pm
- OLAP Product: Cognos TM1
- Version: 10.2.2, 11
- Excel Version: Excel2010
- Location: Bangalore, India
Re: TM1py and python integration with TM1
Thank you Everyone for your insights on this. I have been exploring TM1py samples and this has really given a better picture of python and TM1 integration and its capabilities.
Can you guys please suggest some use cases on TM1py which I can start working on that you have explored?
Can you guys please suggest some use cases on TM1py which I can start working on that you have explored?
- gtonkin
- MVP
- Posts: 1212
- Joined: Thu May 06, 2010 3:03 pm
- OLAP Product: TM1
- Version: Latest and greatest
- Excel Version: Office 365 64-bit
- Location: JHB, South Africa
- Contact:
Re: TM1py and python integration with TM1
Have a look at some of Nick’s videos, some really exciting possibilities open up!
-
- Posts: 3
- Joined: Wed Jul 22, 2015 6:00 pm
- OLAP Product: TM1
- Version: PA 2.0.x
- Excel Version: 2010
Re: TM1py and python integration with TM1
I gave tm1cmp a test drive today. Impressed, will be really useful for automated and ad hoc tests/comparisons.ykud wrote: ↑Tue Jun 16, 2020 12:00 am Have a look at tm1cmp if you haven't already (I need to write a post about it), it has an ability to define your view as MDX or a full spec in JSON file as well that you can re-use?
You should really write a post about it!
Re: TM1py and python integration with TM1
Thanks! Glad you like it, that post is high on my to-do listhermie wrote: ↑Mon Jun 29, 2020 8:21 amI gave tm1cmp a test drive today. Impressed, will be really useful for automated and ad hoc tests/comparisons.ykud wrote: ↑Tue Jun 16, 2020 12:00 am Have a look at tm1cmp if you haven't already (I need to write a post about it), it has an ability to define your view as MDX or a full spec in JSON file as well that you can re-use?
You should really write a post about it!
![Sad :(](./images/smilies/icon_e_sad.gif)