Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 3.19 KB

README.md

File metadata and controls

40 lines (30 loc) · 3.19 KB

powerbi-adt

Commitizen friendly GitHub issues GitHub GitHub Repo stars

Overview

An example showing how to query Azure Digital Twins from within PowerBI. You could use this to query the current state of your IoT devices, for example, to use the Anomaly Detector cognitive service to check the state of outliers.

powerbi-adt is available under the MIT Licence.

Setting up

  1. Create an Azure Digital Twin
  2. Give yourself access to the data plane - add some example data - the Azure Digital Twins explorer example data is a good start.
  3. Create a virtual environment for your Python setup, e.g. python3 -m venv .venv
  4. Install the requirements pip install -r requirements-dev.txt
  5. Copy the path to your venv
  6. Enable python scripting in PowerBI
  7. Log in to Azure on the CLI with az login
  8. Import the powerbi-query.py as a PowerBI datasource

Editing the query

query_expression = "SELECT * FROM digitaltwins"
query_result = service_client.query_twins(query_expression)
twin_list = pd.DataFrame(query_result)

The example query I provide in the query_expression variable will allow you to query the twin graph - and you can use the Azure Digital Twins query language to build on this. Each individual pandas dataframe will appear as a data set in PowerBI.

Example

You should see something like this...

Limitations

Contact

Feel free to contact me on Twitter. For bugs, please raise an issue on GitHub.

Contributing

Contributions are more than welcome! This repository uses the GitHub flow - and you can choose to use Commitizen to support the use of semantic commits. (npm install -g commitizen cz-customizableand then git cz- easy!)