Code Monkey home page Code Monkey logo

tm1py's Introduction

TM1py

TM1py is an object oriented interface to the new IBM Cognos TM1 REST API, written in Python. The module aims to make interaction with TM1 more straightforward.

Features

TM1py offers handy features to interact with TM1 from Python, such as

  • Retrieve data from cubes (in concise JSON structure)
>>> from TM1py import TM1pyQueries as TM1
>>> login = TM1pyLogin.native('admin', 'apple')
>>> tm1 = TM1(ip='localhost', port=8001, login=login, ssl=False)
>>> data = tm1.get_view_content(cube_name='Plan_BudgetPlan',
                                view_name='High Level Profit And Loss')
>>> value = data[('[plan_version].[FY 2004 Budget]',
                  '[plan_business_unit].[10000]',
                  '[plan_department].[1000]',
                  '[plan_chart_of_accounts].[Revenue]',
                  '[plan_exchange_rates].[local]',
                  '[plan_source].[budget]',
                  '[plan_time].[Q2-2004]')]
>>> print(value)
51966012.14
  • Write data into cubes
>>> from TM1py import TM1pyQueries as TM1
>>> login = TM1pyLogin.native('admin', 'apple')
>>> tm1 = TM1(ip='', port=8001, login=login, ssl=False)
>>> cube_name = 'Plan_BudgetPlan'
>>> coordinates_and_values = {
        ('FY 2004 Budget', 'Germany', 'IT', 'Web Site', 'local', 'input', 'Oct-2005'): 5320,
        ('FY 2004 Budget', 'Germany', 'IT', 'Web Site', 'local', 'input', 'Nov-2005'): 6190,
        ('FY 2004 Budget', 'Germany', 'IT', 'Web Site', 'local', 'input', 'Dec-2005'): 5790
    }
>>> tm1.write_values(cube_name, coordinates_and_values)
  • Migrate TM1 objects
>>> from TM1py import TM1pyQueries as TM1
>>> login = TM1pyLogin.native('admin', 'apple')
>>> tm1_source = TM1(ip='localhost', port=8001, login=login, ssl=False)
>>> tm1_target = TM1(ip='localhost', port=56912, login=login, ssl=False)
>>> p = tm1_source.get_process('new')
>>> tm1_target.create_process(p)
  • Execute lines of TI code
>>> from TM1py import TM1pyQueries as TM1
>>> login = TM1pyLogin.native('admin', 'apple')
>>> tm1 = TM1(ip='localhost', port=8081, login=login, ssl=False)
>>> lines_prolog = [
>>>     "AddClient ( 'Chewbacca' );"
>>> ]
>>> lines_epilog = [
>>>     "AssignClientPassword ( 'Chewbacca', 'apple' );",
>>>     "AssignClientToGroup ( 'Chewbacca', 'ADMIN' );",
>>>     "SecurityRefresh;"
>>> ]
>>> tm1.execute_TI_code(lines_prolog=lines_prolog, lines_epilog=lines_epilog)
  • CRUD features for CellAnnotations
  • CRUD features for Processes
  • CRUD features for Chores
  • CRUD features for NativeViews
  • CRUD features for MDXViews
  • CRUD features for Subsets
  • CRUD features for Cubes
  • CRUD features for Dimensions, Elements, ElementAttributes
  • CRUD features for Users
  • Generate MDX from NativeViews
  • Execute Processes and Chores
  • Query Threads
  • Query MessageLog and TransactionLog

Requirements

http://docs.python-requests.org/en/master/

Installation

Download TM1py.py file and copy it into your project folder.

Contribution

TM1py is still at an early stage. Contribution is very welcome.

tm1py's People

Contributors

jischebeck avatar mariuswirtz avatar zpat avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.