Home

Tags

Запуск полного процессинга OLAP из python

2010-04-22 python olap

Для работы скрипта нужен дополнительный пакет pywin32

Процессинг всей базы OLAP

from win32com.client import Dispatch
import pythoncom

def olap_process():
    strServerName = "localhost"
    strDBName = "olap 2"
    try:
        pythoncom.CoInitialize()
        dsoServer = Dispatch("DSO.Server")
        dsoServer.Connect(strServerName)
        dsoDB = dsoServer.MDStores.Item(strDBName)
        print 'server name:',dsoServer.Name
        print 'db name:',dsoDB.Name
        dsoDB.Process(1)
        print 'Process ok'
        pythoncom.CoUninitialize()
    except Exception as e:
        print e


Процессинг отдельного куба OLAP
from win32com.client import Dispatch
import pythoncom

def olap_process():
    strServerName = "localhost"
    strDBName = "olap 2"
    strCubeName = u"Взаиморасчеты"
    try:
        pythoncom.CoInitialize()
        dsoServer = Dispatch("DSO.Server")
        dsoServer.Connect(strServerName)
        dsoDB = dsoServer.MDStores.Item(strDBName)
        dsoCube = dsoDB.MDStores(strCubeName)
        dsoCube.Process(1)
        print 'Process ok'
        pythoncom.CoUninitialize()
    except Exception as e:
        print e

comments powered by Disqus