This Knowledge Base article introduces "mstrio," Python and R packages which provide an interface for the Strategy REST APIs. With a few lines of code, data scientists can extract data from cubes and reports and publish entirely new datasets for consumption by other analysts.
This provides data scientists access to trusted, operational business data using Python and R, which is used in an overwhelming number of data science projects today. With mstrio, data scientists can quickly push their findings into a Strategy dataset, enabling decision-makers to act on the insights. The mstrio packages are supported in Strategy 10.10 and later.
Create a connection to the Intelligence Server using
Connection()and
connect()in Python and R, respectively. Required arguments for the
Connection()function are the URL for the Strategy REST API server, Strategy Intelligence Server username and password, as well as the Strategy project name. By default, the
connect()function anticipates your Strategy Intelligence Server username and password. LDAP authentication is also supported. Use the optional argument
login_mode=16in the
connect()function for LDAP authentication.
To extract data from Strategy cubes and reports, use the
get_cube()and
get_report()functions. Use your connection object and the ID for the cube or report that you are fetching. You can get the ID by navigating to the cube or report within Strategy Web, right-clicking on the desired cube, and selecting Properties. Alternatively, you can use Strategy Developer in a similar manner. The
get_cube()and
get_report()functions will return a data frame with the requested data.
Create a new in-memory dataset with the
create_dataset()function. You'll need to provide a name for your cube, as well as a name for the table that will contain the data. At this time, only one table per cube is supported. The
create_cube()function will return the
datasetIDand
tableID, which can be used to update a dataset with new data.
Once a dataset has been created, you can both update the data within the cube and add new data to it with the
update_dataset()function. Note that you'll need to pass in both the
datasetIDand
tableIDfor the target dataset and table within the dataset, respectively. These are returned by the
create_dataset()function.
update_policyparameter controls the update behavior. Currently supported update operations are: