我有Azure分析服务实例,使用表格模型,我需要通过DAX或MDX从python脚本查询数据。
我从Azure获得了一个看起来像这样的连接字符串:
Provider=MSOLAP;Data Source=asazure://eastus.asazure.windows.net/mymodel;Initial Catalog=mycatalog;User ID=myuser@mail.com;Password=mypass;Persist Security Info=True;Impersonation Level=Impersonate
我尝试使用pyodbc
连接到该连接字符串:
import pyodbc
connection_str = "Provider=MSOLAP;Data Source=asazure://eastus.asazure.windows.net/mymodel;" \
"Initial Catalog=mycatalog;User ID=myuser@mail.com;Password=mypass;" \
"Persist Security Info=True;Impersonation Level=Impersonate"
my_connection = pyodbc.connect(connection_str)
我收到了这个错误:
Traceback (most recent call last):
File "C:/workspace/test.py", line 7, in <module>
my_connection = pyodbc.connect(connection_str)
pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
Process finished with exit code 1