pyp

pypowerbi

Python library for PowerBI

Showing:

Popularity

Downloads/wk

0

GitHub Stars

89

Maintenance

Last Commit

6mos ago

Contributors

11

Package

Dependencies

3

License

MIT

Categories

Readme

pypowerbi

Python library for PowerBI. Loosely modelled after the C# PowerBI library to keep things somehow consistent.

Installation

pip install pypowerbi

Examples

Posting a dataset

import adal
from pypowerbi.dataset import Column, Table, Dataset
from pypowerbi.client import PowerBIClient

# you might need to change these, but i doubt it
authority_url = 'https://login.windows.net/common'
resource_url = 'https://analysis.windows.net/powerbi/api'
api_url = 'https://api.powerbi.com'

# change these to your credentials
client_id = '00000000-0000-0000-0000-000000000000'
username = 'someone@somecompany.com'
password = 'averygoodpassword'

# first you need to authenticate using adal
context = adal.AuthenticationContext(authority=authority_url,
                                     validate_authority=True,
                                     api_version=None)

# get your authentication token
token = context.acquire_token_with_username_password(resource=resource_url,
                                                     client_id=client_id,
                                                     username=username,
                                                     password=password)

# create your powerbi api client
client = PowerBIClient(api_url, token)

# create your columns
columns = []
columns.append(Column(name='id', data_type='Int64'))
columns.append(Column(name='name', data_type='string'))
columns.append(Column(name='is_interesting', data_type='boolean'))
columns.append(Column(name='cost_usd', data_type='double'))
columns.append(Column(name='purchase_date', data_type='datetime'))

# create your tables
tables = []
tables.append(Table(name='AnExampleTableName', columns=columns))

# create your dataset
dataset = Dataset(name='AnExampleDatasetName', tables=tables)

# post your dataset!
client.datasets.post_dataset(dataset)

Authentication & Authorization

It uses adal library for authentication and authorization. If you need step by step way to do auth, please refer to this example on Bitbucket.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial