使用Python ActivePivot MDX将结果转换为CSV

2024-06-13 19:21:08 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我连接AP的代码

import win32com.client

conn = win32com.client.Dispatch(r'ADODB.Connection')
DSN = ('Provider=MSOLAP.4;Password=XXXX;User ID=XXXX;Initial Catalog=Murex Cubes;Data Source=https://<host>:<port>/pivot/xmla;Location=https://<host>:<port>/pivot/xmla;')
conn.Open(DSN)

rs = win32com.client.Dispatch(r'ADODB.Recordset')
strsql = "SELECT NON EMPTY Hierarchize([AsOfDate].[AsOfDate].Members) ON ROWS FROM [MICube]"
rs.Open(strsql, conn, 1, 3)
t = rs.GetRows()
conn.Close()

但我收到以下错误消息。在

pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft OLE DB Provider for Analysis Services 2008.', u'Either a connection cannot be made to the www. server, or Analysis Services is not running on the computer specified.', None, 0, -2147467259), None)


Tags: httpsclienthostportopenconnproviderwin32com