Use case: Copy Analysis from one Celonis instance to another (e.g. IBC->CPM4)

[ ]:
#To get a copy of this notebook in your current working dirtectory, run:
from pycelonis import notebooks

The code moves an analysis from one cluster to another. The user needs the: * source_login: The API credentials for the source instance * target_login: The API credentials for the target instance * source_analysis: Analysis name or ID that should be moved from source_instance * target_workspace: Workspace name or ID of target_instance to which the analysis is moved

[101]:
from pycelonis import get_celonis

Login to the source instance and create a Celonis object.

[103]:
source_login = {
    "celonis_url": "https://ml-appstore.eu-1.celonis.cloud",
    "api_token": "my_api_key"
}

source_instance = get_celonis(**source_login)
Login successful! Hello Ludwig Isert

Find the analysis you want to move in the source cluster either with the analysis ID or the name of the analysis. Then, create a backup of the analysis. The analysis is stored as a parquet file that can then be uploaded in another cluster.

[98]:
source_analysis_id = "50e65a47-99a8-4048-b118-79a6554faaba"

source_analysis = source_instance.analyses.find(source_analysis_id)
backup_path = source_analysis.backup_content()

Now, login into the target instance and create a Celonis object.

[ ]:
target_login = {
    "celonis_url": "http://localhost:9000",
    "api_token": "my_cpm4_api_secret",
    "api_id": "my_cpm4_api_id",
    "username": "my_cpm4_username"
}

target_instance = get_celonis(**target_login)

Find workspace in the target cluster in which you want to create the analysis. Alternatively you could search for an analysis that you want to overwrite.

[100]:
target_folder_name = "Root Cause Analysis"
dm_name = 'Test Datamodel'
dm = target_instance.datamodels.find(dm_name)

# Find the target workspace and create the analysis from the backup
target_workspace = target_instance.folders.find(target_folder_name)
target_workspace.create_analysis("temp", dm, backup_path)
No exact match, guessed: <Workspace, id 6f290cd3-8023-447d-95bd-d8668ead2bd4, name Root cause analysis>