Tm1py: CSV cellset rendering assumes static number of attributes

Created on 10 Mar 2021  路  3Comments  路  Source: cubewise-code/tm1py

CSV cellset rendering assumes static number of attributes. If number of attributes differs between tuples it misaligns data.

bug

Most helpful comment

Thanks! Is it ok to keep this open so I can refer to it when I make a PR?

All 3 comments

Thanks for raising this issue.

Currently, we don't support MDX queries with include_attributes=True but without explicit PROPERTIES statements in the MDX.
If you explicitly specify the attributes that you want to retrieve in the MDX, it should not fail.


from TM1py import TM1Service

with TM1Service(address="", port=12354, user="admin", password="apple", ssl=True) as tm1:
    mdx = """
    SELECT
    {Tm1SubsetAll([d1])} PROPERTIES [d1].[Attribute Something] ON 0,
    {Tm1SubsetAll([d2])} PROPERTIES [d2].[Number] ON 1
    FROM [c1]
    """

    data = tm1.cells.execute_mdx_dataframe(mdx, include_attributes=True)

    print(data)

If you don't want to retrieve attributes from a dimension you can write this.


from TM1py import TM1Service

with TM1Service(address="", port=12354, user="admin", password="apple", ssl=True) as tm1:
    mdx = """
    SELECT
    {Tm1SubsetAll([d1])} PROPERTIES [d1].[Attribute Something] ON 0,
    {Tm1SubsetAll([d2])} PROPERTIES MEMBER_NAME ON 1
    FROM [c1]
    """

    data = tm1.cells.execute_mdx_dataframe(mdx, include_attributes=True)

    print(data)

Can you give this a try?

Please feel free to open a PR if you would like to enhance the existing logic.

Thanks! Is it ok to keep this open so I can refer to it when I make a PR?

Thanks! Is it ok to keep this open so I can refer to it when I make a PR?

absolutely!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hermie64 picture hermie64  路  3Comments

yyzz1010 picture yyzz1010  路  3Comments

pourushgupta picture pourushgupta  路  3Comments

hermie64 picture hermie64  路  3Comments

hermie64 picture hermie64  路  4Comments