George Andersen
George Andersen

Reputation: 24

Process SSAS OLAP cube via Python

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).

Upvotes: -1

Views: 390

Answers (1)

Peter Kazmir
Peter Kazmir

Reputation: 49

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)

Upvotes: 0

Related Questions