Process SSAS OLAP cube via Python

118 views Asked by At

I have an OLAP cube on SSAS (and XMLA script for processing). How can I call processing it via Python script? The only things I can find are about getting data from cubes (mdx/etc), and some popular libraries are really old (for example, xmla was last updated in 2013).

1

There are 1 answers

0
Peter Kazmir On

For loading pd df with mdx query you can use mdx-to-pd. You will provide the mdx query and connection and it will return the dataframe you will need powerbi installed and you will need to have access to cube

from mdx_to_pd import mdx_retriever

connection = "Data Source=https://biserver.company.com/database/;Catalog=Model;"
query = """
        SELECT NON EMPTY [Measures].[Order Count] ON COLUMNS,
        NON EMPTY ([Markets].[Country].[Country]) ON ROWS
        FROM [OLAP_CUBE]
        """
# returns pd.DataFrame()

df = mdx_retriever(query, connection)