Diego Revilla

Diego Revilla

Consultor BI | Power BI | MicroStrategy

Other Articles:

MicroStrategy and Python

Share on linkedin
LinkedIn
Share on facebook
Facebook
Share on twitter
Twitter
Share on whatsapp
WhatsApp

In the world of data analytics, tool integration is critical to maximizing efficiency and accuracy in analysis. In this article, we will explore how to work with MicroStrategy and Python, specifically, how to connect Jupyter Notebook, a popular Python development platform, with MicroStrategy, a leading business intelligence platform. We will use the Python MSTRIO library to facilitate this integration and discuss the necessary requirements and process to achieve this.

MSTRIO provides an advanced Python programming interface designed to provide data scientists, developers and administrators with secure, direct access to their MicroStrategy environment. It allows users to access data from cubes and reports, create and manage datasets, and administrate users, groups, servers, and projects, all without the need to configure additional security rules, as MSTRIO conforms to the MicroStrategy security model.

In the data science space, mstrio-py facilitates the integration of trusted enterprise data, enabling decision-makers to act on predictive information directly in MicroStrategy’s various products, such as reports, dashboards, HyperIntelligence cards and custom analytics applications.

For MicroStrategy administration, mstrio-py simplifies the automation of critical administrative tasks, helping to reduce costs and time. It also allows administrators to leverage Python’s capabilities to handle even the most complex administrative workflows, ensuring efficient maintenance of the MicroStrategy environment.

Prerequisites for the installation of MSTRIO:

  • Python 3.10+.
  • MicroStrategy 2019 Update 4 (11.1.4)+.
  • Having CORS (Cross-Origin Resource Sharing) enabled for MicroStrategy Library Server.

Steps to follow for the initial configuration:

  1. Download and install Python
  2. Download and install Anaconda.
    1. Optional: create an environment in Anaconda Prompt: create –n “nombre” python=3.10
  3. Install mstrio-py from the Anaconda prompt: pip install mstrio-py
  4. Start a jupyter notebook from the Anaconda prompt with the command: jupyter notebook.

Connection between MicroStrategy and Jupyter notebook:

Once MSTRIO is installed in our Python environment, we can establish the connection to MicroStrategy through the Connection object:

				
					from mstrio.connection import Connection
from getpass import getpass
base_url = "https://microstrategy.XXXXXX.es/MicroStrategyLibrary/api"
mstr_username = "Your user name"
mstr_password = getpass("Password:")
project_id = "Your Project Id"
conn = Connection(base_url, mstr_username, mstr_password, project_id=project_id)

				
			

Once the connection is established, we can start interacting with the MicroStrategy project from the Jupyter Notebook, for example, by importing a MicroStrategy report:

				
					from mstrio.project_objects import Report
my_report = Report(connection=conn, report_id=report_id, parallel=False)
df = my_report.to_dataframe()

				
			

Or by exporting a dataframe created in Jupyter:

				
					from mstrio.project_objects import SuperCube
ds = SuperCube(connection=conn, name="NOMBRE DEL CUBO")
ds.add_table(name="NOMBRE DE TABLA", data_frame="NOMBRE_DE_df", update_policy="add")
ds.create()

				
			

For more information on the MSTRIO library we recommend consulting the official documentation at the following link: GitHub – xdumstr/mstrio-py: Python integration for MicroStrategy

Conclusion

In conclusion, the integration between Jupyter Notebook and MicroStrategy through the Python MSTRIO library provides a powerful solution for efficiently and securely analyzing and visualizing enterprise data. By leveraging the Python capabilities of Jupyter Notebook and the robustness of MicroStrategy, users can access reliable data, perform advanced analytics, and make informed decisions more effectively. In addition, MSTRIO’s ease of installation and configuration, along with its ability to automate administrative tasks, make it an invaluable tool for data scientists and system administrators alike.

Deja un comentario

Your email address will not be published. Required fields are marked *

Business Data Master Logo

No te pierdas el

WEBINAR
Gratuito

Explicaremos en detalle los contenidos y objetivos del Business Data Master

29/11/2021

18:30 (GTM+1)

Online

BUSINESS DATA MASTER

* Tu información será utilizada exclusivamente para contactarte en relación al Business Data Master. No hacemos spam ni compartimos datos con terceros.