Giter Club home page Giter Club logo

python-ssas's People

Contributors

yehoshuadimarsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-ssas's Issues

server instead of ssas_server

In the example, it should be server instead of ssas_server

import ssas_api
...:
...: conn = ssas_api.set_conn_string(
...: ssas_server='<YOUR_SERVER>',
...: db_name='<YOUR_DATABASE>',
...: username='',
...: password=''
...: )

Quering on SSAS Tabular with Python

Hello,
My Enterprise has SQL Server Enterprise with SSAS on Tabular mode.
How can I query the SSAS instance with Python?

Can you give me an example using your API?
Thank you!

On procecssing model/table/partitions define MaxParallelism

When invoking SaveChanges it would be better if we could define the maximum parallelism for SSAS to process the objects.

This attribute is available within SaveOptions object:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.analysisservices.tabular.model.savechanges?view=analysisservices-dotnet

Also this method could be adapted to support receiving an array of objects for example (partitions) and these would be processed in parallel.

Error: Unable to obtain authentication

I am getting following error while connecting to Azure server.
My username and password are correct and I am able to connect to Azure manually from SSMS.
However, unable to connect via this python code.

Can someone please let me know about resolution ?

code
import ssas_api

conn = ssas_api.set_conn_string(
ssas_server='<YOUR_SERVER>',
db_name='<YOUR_DATABASE>',
username='',
password=''
)

dax_string = '''
EVALUATE CALCULATETABLE (LOBdd)
'''
df = ssas_api.get_DAX(connection_string=conn, dax_string=dax_string)
print ('df=' ,df)


error:

Microsoft.AnalysisServices.AdomdClient.NonInteractiveLoginException: Unable to obtain authentication token using the credentials provided. If your Active Directory tenant administrator has configured Multi-Factor Authentication or if your account is a Microsoft Account, please remove the user name and password from the connection string, and then retry. You should then be prompted to enter your credentials.
at Microsoft.AnalysisServices.AdomdClient.AadAuthenticator.AcquireToken(String resource, String dataSource, String identityProvider, String tenantId, String userId, String password, Boolean useAdalCache, Boolean useAdTranslation)
at Microsoft.AnalysisServices.AdomdClient.ConnectionInfo.ResolveHTTPConnectionPropertiesForPaaSInfrastructure(Uri& dataSourceUri, Boolean acquireAADToken, Boolean returnCloudConnectionAuthenticationProperties, String& paasCoreServerName, CloudConnectionAuthenticationProperties& cloudConnectionAuthenticationProperties)
at Microsoft.AnalysisServices.AdomdClient.XmlaClient.OpenHttpConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded)
at Microsoft.AnalysisServices.AdomdClient.XmlaClient.OpenConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded)
at Microsoft.AnalysisServices.AdomdClient.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Connect(Boolean toIXMLA)
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP)
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at Microsoft.AnalysisServices.AdomdClient.AdomdDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)

Date parsing does not work with non US locale

Hi, I'm using your script and it works fine, but I've encountered a DateTime parsing issue.

I'm Italian, so the date format is usually DD/MM/YYYY.
By using the locale dependent ToString() it creates some issues with mixed locale environment like mine (software may use Italian or US format and mix up day and months)

ser = df.loc[:, dtt].map(lambda x: x.ToString())

I've solved by using the sortable DateTime format in the previous snippet: x.ToString('s')

Trying to get code running (Importing Pythonnet (Do you have a requirements.txt file))

Hi,

I have spent a few days trying to understand and get this working but to no avail.

I think one of the possible root causes to this is not being able to properly import pythonnet, possibly due to the version or some other issue. I think this could be the reason why some of the clr references in the code don't seem to be working (as I have tried explaining in the other posts #12 ).

Would you be able to:

  • Provide a requirements.txt to ensure that it is known which exact packages are required to use this?
  • Verify/Confirm that all the steps in the README.md are all that is required to get it running (and perhaps expand on minor subtleties if there are any)? As I feel I have followed the instructions however still am coming up with issues (certain lines in ssas.py "line 71-74" not being read properly by my IDE).

Any further assistance on this matter would be helpful.

Create a pypi package please!

Hey, i really thank you for this API because i was really looking for something related.
The maximum thing i found was: https://github.com/S-C-O-U-T/Pyadomd
but didn't work for Azure Analysis Services just for local models.

If i could import automatically the API from PyPI instead of putting the file on the same folder, would be really great!

Again, Thank you!

Running ssas_api.py and getting connected to AAS issue

Hi, I followed the steps in the README.md file and imported the required dll extension (and edited the required version info in the python file path snippet provided as well).

However, once I go to run the a version of the Quickstart I run into an error: NameError: name 'DataTable' is not defined.

Here is the python file path snippet with the correct version and path that I have on my machine:

base = "C:/Program Files/PackageManagement/NuGet/Packages/Microsoft.AnalysisServices"
_version = "19.20.1.0"  # at time of this writing
AMO_PATH = f"{base}.retail.amd64.{_version}/lib/net45/Microsoft.AnalysisServices.Tabular.dll"
ADOMD_PATH = f"{base}.AdomdClient.retail.amd64.{_version}/lib/net45/Microsoft.AnalysisServices.AdomdClient.dll"

My question is:

  • Do I need to edit the actual ssas_api.py script with the file path locations of the .dll files? Not entirely sure what would be required to edit from this in order for the Quickstart snippet to run. Any advice on editing the ssas_api.py script as per the python file path snippets above would be useful.
  • I also noticed midway down the ssas_api.py script I have on my local machine (line 70-73) the following commands aren't working (greyed out in PyCharm Editor):
import System
from System.Data import DataTable
import Microsoft.AnalysisServices.Tabular as AMO
import Microsoft.AnalysisServices.AdomdClient as ADOMD

Not sure if I need to install a package for this to work. I tried performing pip install System but that didn't seem to work, it gave the following error ERROR: Could not find a version that satisfies the requirement System (from versions: none)

Minor Error on QuickStart

QuickStart Sample Code:
.....
conn = ssas_api.set_conn_string(
ssas_server='<YOUR_SERVER>',
db_name='<YOUR_DATABASE>',
username='',
password=''
)
.....

the first server parameter name should change to simply "server",not "ssas_server"

conn = ssas_api.set_conn_string(
server='<YOUR_SERVER>',
db_name='<YOUR_DATABASE>',
username='',
password=''
)

thanks by the way~

Parsing issues when DateTime column is blank

We've got the following error on some queries:

AttributeError: 'float' object has no attribute 'ToString'

at the following line:

ser = df.loc[:, dtt].map(lambda x: x.ToString('s'))

The error seems to happen when we have a DateTime column in the resultset that have some BLANK values. In those cases the variable seems to be float instead of .NET DateTime.

No module named 'ssas_api'

Greetings,

I am trying to test the ssas_api module, but get an error when I try to import ssas_api??

The error message

"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" C:/Users/user/PycharmProjects/PowerBI/SSAS.py
Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/PowerBI/SSAS.py", line 132, in
@_assert_dotnet_loaded
File "C:/Users/user/PycharmProjects/PowerBI/SSAS.py", line 103, in _assert_dotnet_loaded
import ssas_api
ModuleNotFoundError: No module named 'ssas_api'

Process finished with exit code 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.