Connect to your tabular model and perform operations programmatically
Project description
PyTabular
What Does It Do?
PyTabular allows for programmatic execution on your tabular models... In Python!
How Does It Work?
I basically took my two favorite things Python and Tabular Models and connected the two. Thanks to Pythonnet (3.0.0a2) and Microsoft's .Net APIs on Azure Analysis Services. The package should have the dll files included when you import the package.
Getting Started
Importing package
python3 -m pip install python_tabular
In your python environment, import pytabular and call the main Tabular Class. Only parameter needed is a solid connection string.
import pytabular
model = pytabular.Tabular(CONNECTION_STR)
DAX Query
model.Query(DAX_QUERY)
# Returns a Pandas DataFrame
Refresh Tables and Partitions
#filter down the collection to what you want to refresh
tables_to_refresh = [table for table in model.Tables if table.get_Name() in ['Table1','Table2','Table3']]
#Queue up the tables and partitions that you want to refresh.
model.Refresh(tables_to_refresh)
#Once you are ready, update to execute the refresh
model.Update()
Built In Dax Query Helpers
#Query Every Column
model.Query_Every_Column() #Will return pd.DataFrame()
#Query Every Table
model.Query_Every_Table() #Will return pd.DataFrame()
'''
NOTE, notice the default values for the query_function argument.
Query_Every_Column will get COUNTROWS(VALUES(_))
and Query_Every_Table() will get COUNTROWS(_)
with '_' being replaced with the dax identifier to the table or column in question.
You can replace this str with anything you want. For example output the MIN(_) or MAX(_) of each column rather than the default queries.
'''
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_tabular-0.0.8.tar.gz.
File metadata
- Download URL: python_tabular-0.0.8.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6c5dfe05bcce1e664573c57ceb980c00d36edbf4e07232705a08865900c481e
|
|
| MD5 |
598199a3c0d67048d18e255479cad67c
|
|
| BLAKE2b-256 |
9be73878d00e8b208b68aad4c373d0967bf8feaf3465660345568ff4a71a7c70
|
File details
Details for the file python_tabular-0.0.8-py3-none-any.whl.
File metadata
- Download URL: python_tabular-0.0.8-py3-none-any.whl
- Upload date:
- Size: 1.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21eff95e4a2cfeeb2782f5cef3f17efd021c0f0f918b6fbfacb99483ec19a95d
|
|
| MD5 |
767915bae807d539d17b57d8fbdd675e
|
|
| BLAKE2b-256 |
1134214af61962a68c6ac18b9003e8009311702ffe2533b0c8818f3b2f42da94
|