Advertisement
Guest User

Untitled

a guest
Aug 18th, 2016
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. import olap.xmla.xmla as xmla
  2. import time
  3.  
  4. # Connect to OLAP
  5. provider = xmla.XMLAProvider()
  6. connect = provider.connect(location='http://serv-bi.ids-as.local/OLAP/msmdpump.dll',username='test_ssas',password='1234567')
  7. source = connect.getOLAPSource()
  8.  
  9. # OLAP query
  10. cmd="""
  11. select
  12. Non Empty [Client].[Client].[All clients] * {[Measures].[Invoice Count], [Measures].[Invoice Amount]} on 0,
  13. Non Empty [Date].[Year].[Year].AllMembers on 1
  14. from [BI Fake]
  15. """
  16.  
  17. # Execute the query
  18. resource = connect.Execute(cmd,Catalog="TestCube")
  19.  
  20. # Get values of cells
  21. values = resource.getSlice()
  22.  
  23. # Get Axis on columns
  24. columns = resource.getAxisTuple(0)
  25.  
  26. # Get Axis on rows
  27. rows = resource.getAxisTuple(1)
  28.  
  29.  
  30.  
  31. begin = time.clock()
  32. item = source.getCatalog("TestCube").getCube("BI fake").getDimensions()[2].getMembers()
  33.  
  34. print len(item)
  35. '''
  36. for i in range(1,len(item)):
  37.     print item[i-1]
  38. '''
  39.  
  40. #print source.getCatalog("TestCube").getCube("BI fake").getDimensions()[4].getMembers()
  41. print round(time.clock() - begin, 2), "seconds"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement