def list_dependents_example(): # Insert valid credentials username = '******' base_url = 'https://env-******.customer.cloud.microstrategy.com/MicroStrategyLibrary' password = '******' project_name = 'MicroStrategy Tutorial' # Just example project_id = 'B7CA92F04B9FAE8D941C3E9B7E0CD754' # Just example metric_id = '08F9966749975B5C1A4980A3FA8CE3E7' # Just example report_id = 'CAEA8BC44296BB6A89849FBD1161703B' # Just example connection = Connection(base_url, username, password, project_name=project_name) # List dependents of a metric metric_dependents = list_dependents_of_metric(connection, project_id, metric_id) # or List dependents of a metric using more capabilities of `full_search()` object_dependents = full_search(connection, project_id, uses_object_id=metric_id, uses_object_type=ObjectTypes.METRIC, name='Graph', pattern=SearchPattern.CONTAINS, results_format=SearchResultsFormat.LIST, to_dictionary=False) # It is also possible to list dependencies of a metric metric_dependencies = full_search(connection, project_id, used_by_object_id=metric_id, used_by_object_type=ObjectTypes.METRIC, results_format=SearchResultsFormat.TREE) # Other objects, that already have dedicated class, can use premade methods report = Report(connection, report_id) rep_dependents = report.list_dependents() rep_dependencies = report.list_dependencies(to_dictionary=False) return (metric_dependents, object_dependents, metric_dependencies, rep_dependents, rep_dependencies)
is presented. This script will not work without replacing parameters with real values. Its basic goal is to present what can be done with this module and to ease its usage. """ from mstrio.connection import Connection from mstrio.project_objects import OlapCube, Report # get connection to an environment base_url = "https://<>/MicroStrategyLibrary/api" username = "******" password = "******" connection = Connection(base_url, username, password, project_name="MicroStrategy Tutorial", login_mode=1) cube_id = "some_cube_id" report_id = "some_report_id" # get cube based on its id and store it in data frame my_cube = OlapCube(connection=connection, id=cube_id) my_cube_df = my_cube.to_dataframe # get report based on its id and store it in data frame my_report = Report(connection=connection, id=report_id, parallel=False) my_report_df = my_report.to_dataframe # get list of ids of metrics, attributes or attribute elements available within # Cube or Report my_cube.metrics
This script will not work without replacing parameters with real values. Its basic goal is to present what can be done with this module and to ease its usage. """ from mstrio.connection import Connection from mstrio.distribution_services import (list_schedules, list_subscriptions, Schedule, ScheduleEnums, ScheduleTime, Subscription) from mstrio.distribution_services import Event, list_events base_url = "https://<>/MicroStrategyLibrary/api" username = "******" password = "******" conn = Connection(base_url, username, password, login_mode=1) # get list of all schedules all_schedules = list_schedules(connection=conn) # get all event based schedules event_based_schedules = list_schedules( connection=conn, schedule_type=Schedule.ScheduleType.EVENT_BASED.value) # get all expired Schedules expired_schedules = list_schedules(connection=conn, expired=True) # get all events events = list_events(connection=conn) # get single Schedule and list its properties schedule = Schedule(connection=conn, id='AA11BB22CC33DD44EE55FF6677889900') schedule = Schedule(connection=conn, name='On Database Load')
from mstrio.connection import Connection import getpass # The Connection object manages your connection to MicroStrategy. Connect to # your MicroStrategy environment by providing the URL to the MicroStrategy REST # API server, your username, password and the ID of the Project to connect to. # When a Connection object is created the user will be automatically logged-in. # Connection object automatically renews the connection or reconnects, # if session becomes inactive. Reconnection doesn't work if authenticated with # identity token. base_url = "https://your-microstrategy-server.com/MicroStrategyLibrary/api" mstr_username = "******" mstr_password = getpass.getpass("Password: "******"PROJECT_ID" conn = Connection(base_url, mstr_username, mstr_password, project_id=project_id) # The URL for the REST API server typically follows this format: # https://your-microstrategy-server.com/MicroStrategyLibrary/api # Validate that the REST API server is running by accessing # https://your-microstrategy-server.com/MicroStrategyLibrary/api-docs in your # web browser. # To manage the connection the following methods are made available: conn.connect() conn.close() conn.status() # Authentication Methods # Currently, supported authentication modes are Standard (the default) and LDAP.
This script will not work without replacing parameters with real values. Its basic goal is to present what can be done with this module and to ease its usage. """ from mstrio.connection import Connection from mstrio.project_objects import Document, Dossier, list_documents, list_dossiers from mstrio.users_and_groups import list_user_groups, list_users, User, UserGroup base_url = "https://<>/MicroStrategyLibrary/api" username = "******" password = "******" conn = Connection(base_url, username, password, project_name='MicroStrategy Library', login_mode=1) # list all dossiers and documents within a project to which we have connection dossiers = list_dossiers(connection=conn) docs = list_documents(connection=conn) # get document and dossier from by name or id and publish them to a library of # an authenticated user doc = Document(connection=conn, name='Some Simple Document') doss = Dossier(connection=conn, name='Some Simple Dossier') doc.publish() doss.publish() # list all users and get 2 of them
This script will not work without replacing parameters with real values. Its basic goal is to present what can be done with this module and to ease its usage. """ from mstrio.connection import Connection from mstrio.users_and_groups.user import User, list_users from mstrio.users_and_groups.user_group import UserGroup, list_user_groups base_url = "https://<>/MicroStrategyLibrary/api" username = "******" password = "******" conn = Connection(base_url, username, password, application_name="MicroStrategy Tutorial", login_mode=1) # create multiple users users_array = [{ 'username': '******', 'fullName': 'John Williams' }, { 'username': '******', 'fullName': 'Mark Jones' }, { 'username': '******', 'fullName': 'Steve Brown' }, { 'username': '******',
from mstrio.connection import Connection from mstrio.object_management.migration import (bulk_full_migration, bulk_migrate_package, Migration, PackageConfig, PackageContentInfo, PackageSettings) from mstrio.types import ObjectTypes from mstrio.users_and_groups.user import User # Create connection to the source environment source_base_url = "https://<>/MicroStrategyLibrary/api" source_username = "******" source_password = "******" source_conn = Connection(source_base_url, source_username, source_password, project_name="MicroStrategy Tutorial", login_mode=1) # Create connection to the target environment target_base_url = "https://<>/MicroStrategyLibrary/api" target_username = "******" target_password = "******" target_conn = Connection(target_base_url, target_username, target_password, project_name="MicroStrategy Tutorial", login_mode=1) # Make sure the current user have the following privileges: # 'Create package', id: 295