Posts

Showing posts from May, 2023

Microstrategy Workstation scripts to get the quick search results - mstrio Python scripts

 It is Microstrategy Workstation scripts (Python) to get the results from the search object. In the past, this is the usual thing we do in Command Manager.  Lets see a use case to understand this better: List all reports and dashboards in a particular folder and get its details (Report name, Owner, Location, Create date, Mod date, etc).  Usually, we create a search object in Microstrategy and save the search object in a folder. Then we run a command manager script to get the results from the search object.  Here, we will see how to achieve that in Microstrategy Workstation Scripts (Python) Script Logic:  1) Import all packages 2) Establish a connection to Microstrategy project 3) Get the search results in a List object 4) #3 is a complex nested list and nested dictionaries 5) Loop through the nested list and dictionary and construct the path and get owner details 6) Move the results to a data frame 7) Remove unwanted columns from the data frame 8) Add the path and owner details that we

Publish Microstrategy MTDI Super Cube from S3 Parquet file - mstrio Python API

  We need a Python IDE to run this. Currently, some of the Python packages (ex: boto3) are not supported in Microstrategy workstation scripts. So, we can't run this in Microstrategy workstation scripts. Logic:  Install necessary python packages  Import packages (boto3, mstrio, pandas) Establish connection to S3 bucket and read the parquet file Establish connection to Microstrategy Rest server (Library) Create cube We can achieve the same using MSTR Data Import UI. But, in order to connect it to S3 Bucket in MSTR UI, you need "list all buckets" access. In API, we can specify the particular bucket name and parquet file to create this cube. Sample Script: # Install boto3 and mstrio packages. boto3 package is to read files from S3 bucket. mstrio package to connect and create objects in Microstrategy #pip install boto3 #pip install mstrio #Import necessary packages from mstrio.connection import Connection from mstrio.project_objects.datasets.super_cube import SuperCube, list_s