3
我总是使用python获取MDX查询中的单个值。我正在连接到具有xmla支持的icCube。python olap.xmla mdx查询返回单个值?
provider = xmla.XMLAProvider()
con = provider.connect(location='conn_str',username='q1',password='q2')
cmd="""WITH MEMBER Measures.[Avg Profit Margin] AS Sum(SOMETHING, Measures.[Profit Margin]) select NON EMPTY {[Measures].[Profit Margin]} ON columns, {[Client Country]} ON rows FROM [XYZ]"""
res=con.Execute(cmd,Catalog="cube_closed_contracts")
print res.getSlice()
为什么它总是返回单个值?
[[(Cell){
_CellOrdinal = "0"
Value = 0.0358054
FmtValue = "3.58%"
}]]
感谢您的建议。我能够在MDX编辑器中修改查询和测试。我仍然不知道为什么python xmla包不会从res对象返回列名称。在iccube里面,我可以输入mdx查询,并得到一个很好格式化的表,列名等。在python界面中,它只是值。 – 2015-04-03 08:22:26