cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
Introduction
The attached script is intended to loop through all ElastiCube folders in your ElastiCubeData folder and import them.
Business Case
This solution has a couple of possible use cases.  The first is to facilitate migrating a Sisense environment with a large number of ElastiCubes.  The second would be in the case of disaster recovery, where a number of ElastiCubes must be reattached.
Requirements
Python 3 must be installed.
There should be at least one ElastiCube folder in your ElastiCubeData folder that is intended to be imported.

Step 1

Download the attached Python3 Script to your ElastiCubeData folder(usually C:\ProgramData\Sisense\PrismServer\ElastiCubeData).

Step 2

Open a IDLE (Python Editor) window as an Administrator.  Note: You will get a prompt to allow changes for each ElastiCube unless you run as an Administrator.

Step 3

Load the script into IDLE and run.  This can take some time to import all ElastiCubes depending on how many you have and the size.  Enjoy!
Script:
import os
import subprocess

def ImportEC(ECube):
    cmdline = ["cmd", "/q", "/k", "echo off"]
    cmd = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
    batch = b"""\
    cd C:\Program Files\Sisense\Prism
    psm ecube attach path="C:\ProgramData\Sisense\PrismServer\ElastiCubeData\ElasticubeToImport"
    set /p
    exit
    """
    ECubeBytes = bytes(ECube, 'utf-8')
    batch = batch.replace(rb'ElasticubeToImport', ECubeBytes)
    print(batch)
    cmd.stdin.write(batch)
    cmd.stdin.flush()
    result = cmd.stdout.read()
    
EC_List = next(os.walk('.'))[1]

for EC in EC_List:
    
    print('Python appending EC: ' + EC)
    ImportEC(EC)
Rate this article:
Version history
Last update:
‎02-15-2024 02:25 PM
Updated by:
Contributors