Skip to main content

Project Banner

TM1 Bedrock for Python

tm1_bedrock_py is a high-level integration toolkit for IBM Planning Analytics (TM1). It builds on TM1py and pandas to move, transform, validate, and load data between TM1 cubes, SQL databases, CSV files, and dimension structures.

The public API lives in TM1_bedrock_py.bedrock.

Main workflows

Need Function
Transform and write data within one cube data_copy
Move data between cubes or TM1 servers data_copy_intercube
Load SQL data into TM1 load_sql_data_to_tm1_cube
Export TM1 data to SQL load_tm1_cube_to_sql_table
Load CSV data into TM1 load_csv_data_to_tm1_cube
Export TM1 data to CSV load_tm1_cube_to_csv_file
Run TM1-sliced work in parallel async_executor_tm1
Export TM1 slices to SQL in parallel async_executor_tm1_to_sql
Load paginated SQL slices in parallel async_executor_sql_to_tm1
Load a directory of CSV files in parallel async_executor_csv_to_tm1
Build or copy cubes and dimensions cube_builder, dimension_builder, dimension_copy
Build one hierarchy hierarchy_builder, hierarchy_build_from_attributes
Export a dimension schema dimension_export
Run a coordinate-domain calculation pipeline input_handler

Installation

pip install tm1-bedrock-py

Airflow integration is optional:

pip install "tm1-bedrock-py[airflow]"

Python 3.9 or newer is required. The current dependency ranges are defined in pyproject.toml.

Quick start

from TM1py import TM1Service
from TM1_bedrock_py import bedrock

source_mdx = """
SELECT
  {[Period].[Period].[2026-01]} ON 0
FROM [Sales]
WHERE ([Version].[Version].[Actual], [Measure].[Measure].[Amount])
"""

with TM1Service(
    address="tm1.example.com",
    port=12354,
    user="svc_bedrock",
    password="...",
    ssl=True,
) as tm1:
    bedrock.data_copy_intercube(
        tm1_service=tm1,
        data_mdx=source_mdx,
        target_cube_name="Sales Reporting",
        target_dim_mapping={"Scenario": "Reported"},
        clear_target=True,
        target_clear_set_mdx_list=[
            "{[Period].[Period].[2026-01]}",
            "{[Scenario].[Scenario].[Reported]}",
        ],
        async_write=True,
        skip_zeros=True,
    )

Transformation arguments such as source_dim_mapping, related_dimensions, and target_dim_mapping are accepted through the wrappers' **kwargs.

Mapping pipeline

mapping_steps is an ordered list. Supported methods are:

  • replace
  • map_and_replace
  • map_and_join
  • cartesian
  • pivot
  • unpivot
  • basic_reshaping
  • cartesian_with_set

Example:

mapping_steps = [
    {
        "method": "replace",
        "mapping": {"Version": {"Working": "Budget"}},
    },
    {
        "method": "basic_reshaping",
        "new_columns_with_values": {"Load Source": "SQL"},
        "column_relabel_map": {"Amount": "Value"},
    },
]

Invalid mapping and calculation configurations fail before execution with field-level validation messages.

Failure behavior

Public bedrock functions preserve the original exception type and traceback while adding operation and safe parameter context. Passwords, tokens, secrets, credentials, API keys, MDX, and SQL query text are redacted or summarized in Bedrock-generated error messages. Parallel executors wait for their workers and raise if any worker failed; partial failures are not reported as success.

SQL and MDX strings are executable configuration. Only use statements from a trusted source.

Documentation

The full guide includes:

  • current function selection and connection examples;
  • complete bedrock API signatures and parameters;
  • TM1, SQL, CSV, async, dimension, and Airflow workflows;
  • mapping, clearing, performance, and error-handling guidance.

Read the hosted documentation at tm1-bedrock-py.readthedocs.io.

Validation scope

The release hardening suite covers public exception boundaries, offline TM1 wrapper orchestration through MockTM1Service, SQL/CSV fixtures, dimension building, async failure propagation, query redaction, rollback, and cleanup. Live TM1 behavior still requires validation against your Planning Analytics environment because authentication, server configuration, privileges, and version-specific REST behavior cannot be reproduced fully offline.

Development

python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements-dev.txt
pytest
python -m build

The repository may contain tests that require a configured tm1srv connection.

License

Apache-2.0. See LICENSE.

Metadata

Release files for tm1-bedrock-py 1.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tm1-bedrock-py 1.4.3
File Size Uploaded Provenance Actions
tm1_bedrock_py-1.4.3.tar.gz 110.8 kB Without provenance Details for tm1_bedrock_py-1.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tm1-bedrock-py 1.4.3
File Interpreter ABI Platform Actions
tm1_bedrock_py-1.4.3-py3-none-any.whl Python 3 none any Details for tm1_bedrock_py-1.4.3-py3-none-any.whl

Total release size: 206.4 kB

Release files / tm1_bedrock_py-1.4.3.tar.gz

Download URL tm1_bedrock_py-1.4.3.tar.gz
Size 110.8 kB
Tags Source
SHA-256 checksum
How to use checksums
eb34c5015a8cbb28d1f157a51d05a41d5027f6f01514cbec61aefafb90542948
BLAKE2b-256 checksum
How to use checksums
375a52af949b291d68e8ec44d6ca3cc96d50e467aa77819dbb816dbb818f3712
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release files / tm1_bedrock_py-1.4.3-py3-none-any.whl

Download URL tm1_bedrock_py-1.4.3-py3-none-any.whl
Size 95.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9a6f55d0e44f18f3d3bec2b236969587060390deef47827db7d5fec2702f0a3
BLAKE2b-256 checksum
How to use checksums
1da311e6731db2c9f70c8c81e298bea3cbb2a428538e31e0f92feb1ade43cf5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Security for tm1-bedrock-py 1.4.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.4.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page