Skip to main content

A python module for TM1.

Project description

PyPI - License PyPI - Version Pepy Total Downloads

TM1py is the python package for IBM Planning Analytics (TM1).

with TM1Service(address='localhost', port=8001, user='admin', password='apple', ssl=True) as tm1:
    subset = Subset(dimension_name='Month', subset_name='Q1', elements=['Jan', 'Feb', 'Mar'])
    tm1.subsets.create(subset, private=True)

Features

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

  • Functions to read data from cubes through cube views or MDX queries (e.g. tm1.cells.execute_mdx)
  • Functions to write data to cubes (e.g. tm1.cells.write)
  • Functions to update dimensions and hierarchies (e.g. tm1.hierarchies.get)
  • Functions to update metadata, clear or write to cubes directly from pandas dataframes (e.g. tm1.elements.get_elements_dataframe)
  • Async functions to easily parallelize your read or write operations (e.g. tm1.cells.write_async)
  • Functions to execute TI process or loose statements of TI (e.g. tm1.processes.execute_with_return)
  • CRUD features for all TM1 objects (cubes, dimensions, subsets, etc.)

Requirements

Optional Python Packages

  • pandas
  • networkx

Install

without pandas

pip install tm1py

with pandas

pip install "tm1py[pandas]"

Usage

TM1 11 on-premise

from TM1py.Services import TM1Service

with TM1Service(address='localhost', port=8001, user='admin', password='apple', ssl=True) as tm1:
    print(tm1.server.get_product_version())

TM1 11 on IBM cloud

with TM1Service(
        base_url='https://mycompany.planning-analytics.ibmcloud.com/tm1/api/tm1/',
        user="non_interactive_user",
        namespace="LDAP",
        password="U3lSn5QLwoQZY2",
        ssl=True,
        verify=True,
        async_requests_mode=True) as tm1:
    print(tm1.server.get_product_version())

TM1 12 PAaaS

from TM1py import TM1Service

params = {
    "base_url": "https://us-east-1.planninganalytics.saas.ibm.com/api/<TenantId>/v0/tm1/<DatabaseName>/",
    "user": "apikey",
    "password": "<TheActualApiKey>",
    "async_requests_mode": True,
    "ssl": True,
    "verify": True
}

with TM1Service(**params) as tm1:
    print(tm1.server.get_product_version())

TM1 12 on-premise & Cloud Pak For Data

with TM1Service(
        address="tm1-ibm-operands-services.apps.cluster.your-cluster.company.com",
        instance="your instance name",
        database="your database name",
        application_client_id="client id",
        application_client_secret="client secret",
        user="admin",
        ssl=True) as tm1:

    print(tm1.server.get_product_version())

TM1 12 on-premise with access token

params = {
    "base_url": "https://pa12.dev.net/api/<InstanceId>/v0/tm1/<DatabaseName>",
    "user": "8643fd6....8a6b",
    "access_token":"<TheActualAccessToken>",
    "async_requests_mode": True,
    "ssl": True,
    "verify": True
}

with TM1Service(**params) as tm1:
    print(tm1.server.get_product_version())

Documentation

https://tm1py.org/

Issues

If you find issues, sign up in GitHub and open an Issue in this repository

Contribution

TM1py is an open source project. It thrives on contribution from the TM1 community. If you find a bug or feel like you can contribute please fork the repository, update the code and then create a pull request so we can merge in the changes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tm1py-2.2.1.tar.gz (160.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tm1py-2.2.1-py3-none-any.whl (187.8 kB view details)

Uploaded Python 3

File details

Details for the file tm1py-2.2.1.tar.gz.

File metadata

  • Download URL: tm1py-2.2.1.tar.gz
  • Upload date:
  • Size: 160.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for tm1py-2.2.1.tar.gz
Algorithm Hash digest
SHA256 7ca7ecacc1eb4e45c739f251f9f08d307553ab35f195ec7b22c05ba650be6691
MD5 4640f61ee92642f3a3ac9d093b7edddb
BLAKE2b-256 12e16757b3745593cec6547ec14ae8e513c69389b9a1744e974ac6ad92178409

See more details on using hashes here.

File details

Details for the file tm1py-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: tm1py-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 187.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for tm1py-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bfb5fb96e022f0a1d51fbbe202ba67ed0ebaeb144b6ca60bfca47776f57c4c4b
MD5 67b501b712b036bb03728f994bfbdc84
BLAKE2b-256 4b58bdfac04ab01b3abae4b9f6715317412637453bf39c80da545b12cf553475

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page