0

I am trying to connect to a MS Analysis Services OLAP cube via python as explained in [MS Analysis Services OLAP API for Python I used the following code:

import clr
from System.Reflection import Assembly
Assembly.LoadWithPartialName("AnalysisServices.dll")
from Microsoft.AnalysisServices import Server, ProcessType
amoServer = Server()

amoServer.Connect('server')
amoDb = amoServer.Databases['Database']
results = amoServer.Execute('MDX Query')

for result in results:
   print result.Value

However, I got a void/empty result. I know that I am connected correctly to the server because I got the right names for databases, cubes and dimensions.

I also tested the same query in Microsoft SQL Server Management Studio and I got results.

Could you please help me to understand what am I doing wrong to get the empy result? Thank you in advance.

Community
  • 1
  • 1
jpceia
  • 113
  • 2
  • 11
  • did you play round with the query that you are sending ? – whytheq Mar 15 '16 at 18:50
  • @whytheq it gives always an empty result. It is not problem from the query. – jpceia Mar 15 '16 at 19:19
  • is this the only option `result.Value`? – whytheq Mar 15 '16 at 19:21
  • 1
    I believe this is answered here http://stackoverflow.com/questions/24723438/execute-query-on-sql-server-analysis-services-with-ironpython – GregGalloway Mar 15 '16 at 23:50
  • @GregGalloway, I tried that solution and it works, however, this one should also work. – jpceia Mar 16 '16 at 10:18
  • @hardflow the approach in your question uses the AMO library which is meant for administration. I suppose you could run queries with it but that's not its purpose and you will be frustrated. Just use ADOMD.NET (AdomdClient) like my link shows. It is meant for running queries. – GregGalloway Mar 16 '16 at 11:25

0 Answers0