Skip to content

Instantly share code, notes, and snippets.

@dankor
Created May 26, 2017 20:13
Show Gist options
  • Save dankor/bd8b944820a902e3f90a12231cb95a64 to your computer and use it in GitHub Desktop.
Save dankor/bd8b944820a902e3f90a12231cb95a64 to your computer and use it in GitHub Desktop.
pythonet cube processing
import CLR
from CLR.System.Reflection import Assembly
Assembly.LoadWithPartialName("AnalysisServices.DLL")
from CLR.Microsoft.AnalysisServices import Server
from CLR.Microsoft.AnalysisServices import ProcessType
serverName = 'localhost\sql2005'
dbName = 'MyDatabase'
# Connect to server
amoServer = Server()
amoServer.Connect(serverName)
# Connect to database
amoDb = amoServer.Databases[dbName]
amoDb.Process(ProcessType.ProcessFull)
@biomedatascientistSV
Copy link

HI i tried using the clr after installing python.net
There is an error with finding modules System
Annotation 2020-05-15 175233

@dankor
Copy link
Author

dankor commented May 16, 2020

LOL, the character case matters in python: you have installed and imported clr. It has nothing to do with pythonnet.

@biomedatascientistSV
Copy link

biomedatascientistSV commented May 16, 2020 via email

@dankor
Copy link
Author

dankor commented May 16, 2020

I just tried my code and found out that it is deprecated already for a while. Instead, you have to use something like the following:

import clr
clr.AddReference('AnalysisServices')

However, I'm not interested to keep digging it out. See the updated documentation for more details.

@biomedatascientistSV
Copy link

Ok, thx, just to let you know, your above code also does not work. Will check the the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment