Skip to main content

MDX query reader from Microsoft Analytics Services OLAP returning pandas DataFrame

Project description

mdx_to_pd

mdx to pd is a Python library for retrieving data from Microsoft Analytics Services OLAP cube using the mdx query Returned outcome comes in the pandas dataframe for further data processing. Works also behind the corporate proxy.

Installation

Use the package manager pip to install mdx_to_pd. In order for mdx_to_pd to work it is necessary to have Microsoft.PowerBI.AdomdClient.dll. Package works on Windows only!

pip install mdx-to-pd

Usage

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)

# mdx or dax query can be provided
# returns df based on mdx query with column names with whitespace replaced by '_'
# to return own column whitespace replacement string, add parameter 

df = mdx_retriever(query, connection,'-')

# in case of error due to missing Microsoft.PowerBI.AdomdClient.dll
# please follow prompts in terminal.
# package expects file located in 
# c:\Program Files\Microsoft Power BI Desktop\bin\ but path is not
# existing it will search for the file on c: drive and will suggest to add this as parameter

df = mdx_retriever(query, 
                   connection,
                   '-',
                   'c:\\alternative_path_to\\Microsoft.PowerBI.AdomdClient.dll')

# all options:
mdx_retriever(
     query: str, # mdx query
     conn:str, # connection to OLAP CUBE,
     whitespace_replacer: str #optional replacement string for column whitespaces
     alternative_dll_path: str #optional alternative path to Microsoft.PowerBI.AdomdClient.dll
)

## Contributing

Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License

[MIT](https://choosealicense.com/licenses/mit/)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdx_to_pd-0.0.6.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdx_to_pd-0.0.6-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file mdx_to_pd-0.0.6.tar.gz.

File metadata

  • Download URL: mdx_to_pd-0.0.6.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for mdx_to_pd-0.0.6.tar.gz
Algorithm Hash digest
SHA256 9cb15879f9c42f17c30ff493eab8496d5d5550959b95f05b87ab4fbc134927aa
MD5 1d635f2a05059e56fb5053ab68a07552
BLAKE2b-256 5cf9fef7579df903f6191c375fa38124da18a5c635659e14771cd22e075f1a06

See more details on using hashes here.

File details

Details for the file mdx_to_pd-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: mdx_to_pd-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for mdx_to_pd-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7bcc1a1d409c1bb9ded9452bd0b4abd28ec92f3ccd3a7e95e72a75b14f1c1b30
MD5 3d4bcc203d7f2c4ba2f028bc211499a8
BLAKE2b-256 22b0afbf84c4979f0608d967f985f5bbc9ee6531c3a08713fe023b433d5dc678

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page