We are trying to use the powerbiclient package inside an Azure Databricks notebook to get information on reports but we are getting the error Exception: Power BI report is not embedded.
The same code works instead if we use it locally on Visual Studio Code.
Azure Databricks cluster: Personal Compute, runtime 15.1 ML
If we try to display the report we obtain nothing:
def loaded_callback(event_details):
print('Report is loaded')
report.on('loaded', loaded_callback)
def rendered_callback(event_details):
print('Report is rendered')
report.on('rendered', rendered_callback)
report.set_size(200, 300)
report
And if we try to get the pages we get the aforementioned error:
pages = report.get_pages()
Exception Traceback (most recent call last)
File <command-2809091020085831>, line 3
1 report_dict = {}
2 # Get list of pages
----> 3 pages = report.get_pages()
4 for page in pages:
5 report.set_active_page(page['name'])
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-48b6b502-a176-4d52-a15d-9ed2a921ac04/lib/python3.11/site-packages/powerbiclient/report.py:566, in Report.get_pages(self)
560 """Returns pages list of the embedded Power BI report
561
562 Returns:
563 list: list of pages
564 """
565 if not self._embedded:
--> 566 raise Exception(self.REPORT_NOT_EMBEDDED_MESSAGE)
568 # Start getting pages on client side
569 self._get_pages_request = True
Exception: Power BI report is not embedded
We are trying to use the
powerbiclient
package inside an Azure Databricks notebook to get information on reports but we are getting the errorException: Power BI report is not embedded
. The same code works instead if we use it locally on Visual Studio Code.Here is the code we are using:
We tried both authenticating via Device Code Login and Service Principal but we need to stick with the second option:
And then we call the report:
But we see that it is not embedded:
If we try to display the report we obtain nothing:
And if we try to get the pages we get the aforementioned error:
What could be the error?