通过xmla访问olap数据源

xmla的Python项目详细描述


olap.xmla

此包用于访问xmla数据源-请参阅 http://en.wikipedia.org/wiki/XML_for_Analysis

建筑

在此目录中,运行:

python setup.py build

测试

对mondrian、ssas、iccube xmla提供者进行测试。这个 testsdiscover模块使用不同的xmla提供程序测试行为 testsexecute执行时的discover命令 命令。请注意,如果您希望 测试你自己,因为它们包含了细节(即 服务和数据源的名称)。

样品

下面是一个如何使用它的示例:

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])

使用程序界面:

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()

包含的vs.wsdl源于以下包: http://www.microsoft.com/en-us/download/confirmation.aspx?id=9388和 随后被修改(soap头中的参数)为 使用suds package.olap.xmla

更改

0.7.2

  • 现在依赖于请求1.2.3
  • 修复了kerberos auth中的竞争条件

0.7.1

  • kerberos身份验证已发送两次

0.7

  • 现在可以处理请求0.14和1。-一系列请求
  • 选择单元格属性失败

0.6

  • 依赖kerberos和s4u2p现在是可选的
  • 通过pywin32通过sspi为windows上的kerberos添加了可选的kerberos sspi包

0.5

  • as_userspn在kerberos身份验证中不再被忽略
  • 从olap.interfaces实现了过程接口
  • 当没有SLILIXAX信息返回< /LI>时的固定问题
  • getslice的参数property现在拼写为properties

0.4

  • 关键字kerberos已不存在。会自动检测到kerberos身份验证需要
  • BeginSessionEndSession提供xmla会话支持
  • 使用iccube xmla provider的更改

0.3

  • 已更改xmlprovider中的关键字doKerberos。请连接到kerberos
  • 向xmlprovider.connect添加了sslverify关键字,默认为True。 这将被传递给requests get方法,因此您可以将其指向证书捆绑包文件。

0.2

  • 删除了对setup.py中特定版本的依赖关系

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何使用JNA创建同一库的多个实例?   java在将Graphql查询作为JSON字符串传递时收到意外的令牌错误   OAuth2 oltu的java问题   java桌面应用程序使用的好的嵌入式数据库是什么?   java Firebase数据库高级查询选项   java正在使磁盘上的EhCache元素过期   java 安卓还原处于backstack中的片段的实例状态   XMemcached中的java异步集   java TimescaleDB是否使用与Postgresql完全相同的JDBC驱动程序?   java从网站c读取信息#   检查java Android中的字符串是否只包含数字和空格   c#如何向web服务发送特殊字符?   grails无法调用需要java的方法。lang.类参数?   java我在组合框中调用的方法不会运行所有代码,它只运行部分代码   java发送带有标头的HTTP GET请求