S-C-O-U-T / Pyadomd

A pythonic approach to query SSAS data models.
https://pyadomd.readthedocs.io/en/latest/index.html
Apache License 2.0
25 stars 6 forks source link

AdomdConnection #1

Closed acasterm closed 4 years ago

acasterm commented 4 years ago

When I try to instantiate the Pyadomd object on init, I get the error below:

"File 'C:\my_path\pyadomd.py', line 125, in init "self.conn = AdomdConnection()" "Name error: name 'AdomdConnection' is not defined".

I add the DLL to my path as specified in the README.md

I am able to successfully run the code below successfully in my interpreter with the AdomdConnection object:

from pyadomd import * clr.AddReference('Microsoft.AnalysisServices.AdomdClient') from Microsoft.AnalysisServices.AdomdClient import AdomdConnection, AdomdCommand adoObj = AdomdConnection() adoObj.ConnectionString = 'my_connection_string' adoObj.Open() print(adoObj.State) 1

S-C-O-U-T commented 4 years ago

Which python version and AdomdClient dll are you using?

I’m not able to reproduce the error, could you post the code that produces the error?

acasterm commented 4 years ago

Using python 3.7.4, Microsoft.AnalysisServices.AdomdClient.dll file version: 12.0.2000.8.

Screenshot below of Pyadomd error, and success connecting directly through AdomdConnection object from Microsoft.AnalysisServices.AdomdClient

Adomd

ADOMD2

S-C-O-U-T commented 4 years ago

It’s looks like it is the order of which you add the ADOMD dll to your path and initialize it. The package is looking up the ADOMD dll during import. That’s why you’re getting the error right after the import. Try to first to add the dll to the path, such that your code looks like this:

dll = 'C:\\Program Files\\Microsoft.NET\\ADOMD.NET\\120 from sys import path path.append(dll)

and afterwords import the package

from pyadomd import Pyadomd

S-C-O-U-T commented 4 years ago

Did above solve the problem? 😊

forceair commented 3 months ago

It’s looks like it is the order of which you add the ADOMD dll to your path and initialize it. The package is looking up the ADOMD dll during import. That’s why you’re getting the error right after the import. Try to first to add the dll to the path, such that your code looks like this:

dll = 'C:\\Program Files\\Microsoft.NET\\ADOMD.NET\\120 from sys import path path.append(dll)

and afterwords import the package

from pyadomd import Pyadomd

thank you this method is cool!