Skip to main content

olap.xmla

This package is meant for accessing xmla datasources - see http://en.wikipedia.org/wiki/XML_for_Analysis

Builing

In this directory, run:

python setup.py build

Testing

Tests are done against the Mondrian, SSAS, icCube XMLA providers. The testsDiscover module tests behavior with different XMLA providers with the Discover command while testsExecute does the same with the Execute command. Note that you likely need to modify the sources if you want to test yourself since they contain specifics (namely the location of the services and names of the data sources).

Sample

Here is an example how to use it:

import olap.xmla.xmla as xmla

p = xmla.XMLAProvider()
# mondrian
c = p.connect(location="http://localhost:8080/mondrian/xmla")
# to analysis services (if iis proxies requests at /olap/msmdpump.dll)
# you will need a valid kerberos principal of course
# c = p.connect(location="https://my-as-server/olap/msmdpump.dll",
#               sslverify="/path/to/my/as-servers-ca-cert.pem")
# to icCube
# c = p.connect(location="http://localhost:8282/icCube/xmla", username="demo",
#               password="demo")

# getting info about provided data
print c.getDatasources()
print c.getMDSchemaCubes()
# for ssas a catalog is needed, so the call would be like
# get a catalogname from a call to c.getDBSchemaCatalogs()
# c.getMDSchemaCubes(properties={"Catalog":"a catalogname"})

# execute a MDX (working against the foodmart sample catalog of mondrian)
cmd= """select {[Measures].ALLMEMBERS} * {[Time].[1997].[Q2].children} on columns,
[Gender].[Gender].ALLMEMBERS on rows
from [Sales]
"""

res = c.Execute(cmd, Catalog="FoodMart")
#return only the Value property from the cells
res.getSlice(properties="Value")
# or two props
res.getSlice(properties=["Value", "FmtValue"])

# to return some subcube from the result you can
# return all
res.getSlice()
# carve out the 4th column
res.getSlice(Axis0=3)
# same as above, SlicerAxis is ignored
res.getSlice(Axis0=3, SlicerAxis=0)
# return the data sliced at the 2nd and 3rd row
res.getSlice(Axis1=[1,2])
# return the data sliced at the 2nd and 3rd row and at the 4th column
res.getSlice(Axis0=3, Axis1=[1,2])

Using the procedural interface:

import olap.xmla.xmla as xmla

p = xmla.XMLAProvider()
c = p.connect(location="http://localhost:8080/mondrian/xmla")
s = p.getOLAPSource()

# import olap.interfaces as oi
# oi.IOLAPSource.providedBy(s) == True

s.getCatalogs()
s.getCatalog("FoodMart").getCubes()
s.getCatalog("FoodMart").getCube("HR").getDimensions()
s.getCatalog("FoodMart").getCube("HR").getDimension("[Department]").\
getMembers()
s.getCatalog("FoodMart").getCube("HR").getDimension("[Department]").\
getMember("[Department].[14]")

cmd= """select {[Measures].ALLMEMBERS} * {[Time].[1997].[Q2].children} on columns,
[Gender].[Gender].ALLMEMBERS on rows
from [Sales]
"""
res=s.getCatalog("FoodMart").query(cmd)
res.getSlice()

Note

The contained vs.wsdl originates from the following package: http://www.microsoft.com/en-us/download/confirmation.aspx?id=9388 and was subsequently modified (which parameters go in the soap header) to work with the suds package.olap.xmla

CHANGES

0.7.2

  • now relies on requests 1.2.3

  • fixed race condition in kerberos auth

0.7.1

  • kerberos-auth was sent twice

0.7

  • works now with requests 0.14- and 1.-series of requests

  • selection of cell properties failed

0.6

  • dependency on kerberos and s4u2p is now optional

  • added optional kerberos-sspi package for kerberos on windows through sspi via pywin32

0.5

  • as_user and spn are no longer ignored in the kerberos authentication

  • implemented the procedural interface from olap.interfaces

  • fixed problem when no sliceraxis info is returned

  • parameter property of getSlice now spells properties

0.4

  • keyword kerberos is gone. kerberos auth need is detected automatically

  • BeginSession and EndSession provide XMLA Sessionsupport

  • changes to work with icCube XMLA provider

0.3

  • changed keyword doKerberos in XMLProvider.connect to kerberos

  • added sslverify keyword to XMLProvider.connect defaulting to True. This will be handed to requests get method, so you can point it to your certificate bundle file.

0.2

  • removed dependencies on specific versions in setup.py

Metadata

Release files for xmla 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xmla 0.7.2
File Size Uploaded Provenance Actions
xmla-0.7.2.tar.gz 18.5 kB Without provenance Details for xmla-0.7.2.tar.gz

Release files / xmla-0.7.2.tar.gz

Download URL xmla-0.7.2.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
65231acceed17651f15805977d24d2d177e897a094875f43be044b738bd31444
BLAKE2b-256 checksum
How to use checksums
2ebc34ba1b585057b316c5029a7e310fd172d6138ae95453c755f01ce6ee7471
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for xmla 0.7.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page