--- id: mdxpy version: "1.3.2" license: MIT-LICENSE license_treatment: permissive maintenance: active --- # mdxpy — A simple, yet elegant MDX library for TM1 License: permissive · Maintenance: active · Downloads: 291.8K/mo ## What it is and what it does MDXpy is a Python library for constructing MDX (Multidimensional Expressions) queries used by IBM Cognos TM1 and Planning Analytics. Instead of writing raw MDX strings, you use classes like Member, MdxTuple, MdxHierarchySet, and MdxBuilder to assemble queries programmatically. The library handles syntax details—bracket escaping, proper nesting, function formatting—so you focus on the query logic rather than MDX grammar. The package supports a broad set of MDX functions including TM1SUBSETALL, FILTER, TOPCOUNT, UNION, and others, and allows chaining operations in a functional style. It handles multi-axis queries, calculated members, dimension properties, and zero suppression configuration. The main benefit is reducing syntax errors and making queries easier to refactor and maintain, especially for teams less familiar with MDX syntax. Use it for: - Build dynamic TM1 queries in Python without manually escaping brackets or worrying about missing parentheses - Generate MDX queries for Planning Analytics reports where query structure varies based on user input or configuration - Construct multi-axis MDX queries with calculated members and dimension properties for complex reporting - Refactor existing raw MDX strings into maintainable, version-controlled Python code - Create reusable query templates by composing Member, MdxHierarchySet, and MdxBuilder objects ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Builds MDX queries programmatically for TM1 and IBM Cognos Planning Analytics, eliminating manual syntax errors and escaping concerns. Yes, if you work with TM1 or IBM Cognos Planning Analytics and write MDX queries regularly. The library eliminates a common source of errors and makes queries more maintainable. The high install friction is a minor drawback, but the active maintenance status and zero security vulnerabilities support adoption. Not relevant for projects that do not use TM1 or Planning Analytics. ## Install pip install mdxpy uv add mdxpy poetry add mdxpy ## Installing mdxpy Before you install: High install friction reported; package has no runtime dependencies but the distribution artifact suggests potential build or extraction complexity. Maintenance is active with recent commits. License in practice: MIT license (permissive) allows commercial and private use with minimal restrictions—suitable for most projects. Quickstart: from mdxpy import Member, MdxTuple, MdxBuilder mdx_tuple = MdxTuple.of(Member.of("Product", "Product1"), Member.of("Region", "US")) print(mdx_tuple.to_mdx()) query = MdxBuilder.from_cube("Cube").add_hierarchy_set_to_column_axis( MdxHierarchySet.all_leaves("Product") ).to_mdx() Verify before relying: - Whether high install friction stems from a compiled dependency or packaging issue not evident in the metadata - Whether the gap between latest release (2023-08-07) and current date indicates active maintenance or dormancy despite recent commits ## Package facts - License: MIT-LICENSE (permissive) - Python support: supports_current - Install friction: high - Maintenance: active - Downloads: 291.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags MDX query builder, TM1 query construction, IBM Cognos Planning Analytics, MDX syntax generation, programmatic MDX, TM1 member queries, MDX set operations, mdx-query-builder, tm1-cognos, olap [View on SkillFed](https://skillfed.io/packages/mdxpy) · [View on PyPI](https://pypi.org/project/mdxpy/)