microsoft / powerbi-jupyter Goto Github PK
View Code? Open in Web Editor NEWA Custom Jupyter Widget Library for Power BI
License: MIT License
A Custom Jupyter Widget Library for Power BI
License: MIT License
Hi, i'm trying to setup powerbi in my jupyter notebook, managed to.
followed the steps
https://powerbi.microsoft.com/en-us/blog/announcing-power-bi-in-jupyter-notebooks/
but have now this error at the end
('Could not create access token or embed URL: ', Exception('Get embed URL failed with status code ', 401))
What should I do?
Thanks for your help;
Hi, would it be possible when initializing the report, to preset filters and set it to a given report page? Or would that be accomplished by using a bookmark that takes the user to a certain page?
How about embedding only a specific visual from a given page?
If not possible today, is it in the backlog? Thank you.
Enviroment:
Python 3.10.11 (main, May 15 2023, 19:29:30) [Clang 14.0.6 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.12.0 -- An enhanced Interactive Python. Type '?' for help.
pandas 2.0.2
Function:
PBI_visualize = QuickVisualize(get_dataset_config(df_pbi_), auth=interactive_auth) # auth=device_auth
PBI_visualize
Error:
AttributeError: 'DataFrame' object has no attribute 'dtype'
Getting this error despite all package requirements being satisfied. Using jupyter lab
Have you seen this before?
Hi team,
I have a service principal account and I would like to pass my bearer access token to Report() to avoid using either DeviceCodeLoginAuthentication or InteractiveLoginAuthenticationto prevent browser launching a page - so that I can perform this in remote machines.
group_id= ""
report_id= ""
report = Report(group_id=group_id, report_id=report_id, auth = access_token, view_mode=EmbedMode.VIEW.value)
Throws "LoadReportFailed - Fail to initialize - Could not resolve cluster".
Below is one of the methods I have used to obtain access token. (I have also used azure.identity ClientSecretCredential and adal libraries too which are not listed here, but failed to embed the report.)
tenant_id = ""
resource = "https://analysis.windows.net/powerbi/api"
client_id = ""
client_secret = ""
token_endpoint = f"https://login.microsoftonline.com/{tenant_id}/oauth2/token"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
data = {
"grant_type": "client_credentials",
"client_id": client_id,
"client_secret": client_secret,
"resource": resource
}
response = requests.post(token_endpoint, data=data)
access_token = response.json()["access_token"]
Getting error while running the bellow code and am also running the Jupiter lab in the container, so for that please also check the Dockerfile.
Tried many combination but none of the solution worked.
from powerbiclient import Report, models
from powerbiclient.authentication import DeviceCodeLoginAuthentication
device_auth = DeviceCodeLoginAuthentication()
group_id="Workspace ID"
report_id="Report ID"
report = Report(group_id=group_id, report_id=report_id, auth=device_auth)
report
error displaying widget model not found
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
RUN microdnf update -y &&
microdnf install -y python38 wget tar gzip zip unzip git gcc-c++.x86_64 python38-devel python38-setuptools &&
microdnf clean all
RUN dnf module -y install nodejs:18
WORKDIR /
RUN pip3 install ipympl matplotlib jupyterlab virtualenv powerbiclient ipywidgets ipympl
RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager &&
jupyter labextension install jupyter-matplotlib &&
jupyter labextension update --all &&
jupyter lab build
RUN mkdir -p /users/home /jupyter/kernels &&
chmod -R 755 /users /jupyter
EXPOSE 8880 8866
CMD ["jupyter", "lab", "--notebook-dir=/users", "--allow-root", "--port=8866", "--ip=0.0.0.0"]
Hello guys,
I have a dataset that has row-level security.
embed_token_request_body = {"accessLevel": "View", "identities": [
{
"username": "[email protected]",
"roles": ["BVC"],
"datasets":[dataset_id]
}
]}
I passed embed_token_request_body parameter with json value (json.dumps(embed_token_request_body)) have "identities" (https://docs.microsoft.com/en-us/rest/api/power-bi/embed-token/reports-generate-token-in-group#generate-paginated-report-embedtoken-with-effectiveidentity), then received "message":"The request contains an entity body but no Content-Type header. The inferred media type 'application/octet-stream' is not supported for this resource."
Another way, I also passed embed_token_request_body parameter with dict value (embed_token_request_body itself), then received "message":"Creating embed token with multiple identities is not supported"
I read your report.py, then try to change line 751 (
powerbi-jupyter/powerbiclient/report.py
Line 751 in f6ece2b
Hope you guys will fix this.
Thanks.
Why if i get the access_token using microsoft graph application it fail to load the report ?, is it possible to authentication only for and app and not using human interaction ?
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.
Here is the code we are using:
!pip install powerbiclient
dbutils.library.restartPython()
from powerbiclient import Report, models
from io import StringIO
from ipywidgets import interact
import requests
import json
We tried both authenticating via Device Code Login and Service Principal but we need to stick with the second option:
# # option 1
# from powerbiclient.authentication import DeviceCodeLoginAuthentication
# device_auth = DeviceCodeLoginAuthentication()
# option 2
def azuread_auth(tenant_id: str, client_id: str, client_secret: str, resource_url: str):
"""
Authenticates Service Principal to the provided Resource URL, and returns the OAuth Access Token
"""
url = f"https://login.microsoftonline.com/{tenant_id}/oauth2/token"
payload = f'grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}&resource={resource_url}'
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
access_token = json.loads(response.text)['access_token']
return access_token
tenant_id = 'XXX'
client_id = 'YYY
client_secret = 'ZZZ'
scope = 'https://analysis.windows.net/powerbi/api/.default'
resource_url = 'https://analysis.windows.net/powerbi/api'
token = azuread_auth(tenant_id, client_id, client_secret, resource_url)
And then we call the report:
group_id = '123-456'
dataset_id = 'abc-def'
report_id = '7g8-h9i'
report = Report(group_id=group_id, report_id=report_id, auth=token)
But we see that it is not embedded:
print(report._embedded)
# False
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
What could be the error?
I would like to know if it would be possible to get this added to Conda-Forge. I am willing to do the work to do it, if it is allowed. I will have to learn how first, but it is something that I have been wanting to learn.
Hi!
I have tried running a notebook based on the wiki and the announcement page (using device auth) and on one computer it can embed the report but fails after running the get_filters code. On the other computer with the same notebook in 4 tries it could only once embed the report and the kernel dies. In both cases Anaconda was updated to the latest and the notebooks are strong machines.
``
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# Import Report class and models\n",
"from powerbiclient import Report, models\n",
"import pandas as pd\n",
"# Import DeviceCodeLoginAuthentication class to authenticate to Power BI\n",
"from powerbiclient.authentication import DeviceCodeLoginAuthentication"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Performing interactive authentication. Please follow the instructions on the terminal.\n",
" To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code DET2UAPZW to authenticate.\n",
"You have logged in.\n",
"Interactive authentication successfully completed.\n"
]
}
],
"source": [
"# Initiate device authentication\n",
"device_auth = DeviceCodeLoginAuthentication()\n",
"\n",
"# Get access token from auth object\n",
"access_token = device_auth.get_access_token()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6e6e49334169493aad4821e8c91d7dff",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Report()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Set workspace Id and report Id\n",
"group_id="2c411c27-e41d-4d77-8c1b-c087fb6744ec"\n",
"report_id="aaae5a96-3e0d-4709-a727-9dd5e62f4509"\n",
"\n",
"# Create an instance of Power BI Report (Use either of the below instances)\n",
"# Use auth object\n",
"report = Report(group_id=group_id, report_id=report_id, auth=device_auth)\n",
"\n",
"# Use access token from device authentication\n",
"report = Report(group_id=group_id, report_id=report_id, access_token=access_token, token_type=models.TokenType.AAD.value)\n",
"\n",
"# Load the report in the output cell\n",
"report"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"report.set_dimensions(800, 1100)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'name': 'ReportSection1ef29e413d069478ab55',\n",
" 'displayName': 'Bar and column',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectiond8b7c2eb140ac63223c0',\n",
" 'displayName': 'Matrix',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectionf7a8e1b14d9ab030c5ed',\n",
" 'displayName': 'Matrix Details',\n",
" 'isActive': False,\n",
" 'visibility': 1,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection0b7bb46c903b8ec5de08',\n",
" 'displayName': 'Line Charts',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection98b20e874029520bada9',\n",
" 'displayName': 'Pie Donut Charts',\n",
" 'isActive': True,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection86a83f5b4e955e81e232',\n",
" 'displayName': 'KPI Card and Gauge',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection9be595fc50d900312a2b',\n",
" 'displayName': 'Maps',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection7ee2636508467a9cb665',\n",
" 'displayName': 'Sales Tooltip',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'width': 320, 'height': 240},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectionbd579275497cd0a23b79',\n",
" 'displayName': 'ArcGIS Map',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection519fb7909a3879a736a7',\n",
" 'displayName': 'Time Intelligence',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectionca74ca96ba2cca3b2de1',\n",
" 'displayName': 'Smart Narratives',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection022294dfd722ac1c09d0',\n",
" 'displayName': 'Waterfall Chart',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection38574311eb5a78276dce',\n",
" 'displayName': 'Ribbon Slicer filters',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectionf7488c4d9e48e01a207a',\n",
" 'displayName': 'Percentage',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectione196bfddc0ed64c0a685',\n",
" 'displayName': 'Conditional Formatting',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0}]"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pages = report.get_pages()\n",
"pages"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'name': '1dd4c239217de4004080',\n",
" 'title': 'Country sl',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 875.363748458693,\n",
" 'y': 0,\n",
" 'z': 0,\n",
" 'width': 131.3933415536375,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': '183f798992ebbdc7a0eb',\n",
" 'title': 'Manufacturer sl',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 317.82983970406906,\n",
" 'y': 0,\n",
" 'z': 3000,\n",
" 'width': 165.12946979038225,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': 'ef3a420088062841a78a',\n",
" 'title': 'Channel sl',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 173.11960542540075,\n",
" 'y': 0,\n",
" 'z': 4000,\n",
" 'width': 134.05672009864364,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': '7ff2944372857bc05308',\n",
" 'title': 'PBI logo',\n",
" 'type': 'image',\n",
" 'layout': {'x': 1026.0912453760789,\n",
" 'y': 0,\n",
" 'z': 1000,\n",
" 'width': 253.90875462392108,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': '781a42009bb013cbba21',\n",
" 'title': 'ProdCategory',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 669.3958076448829,\n",
" 'y': 0,\n",
" 'z': 1000,\n",
" 'width': 191.7632552404439,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': 'de45e472e0edde6b8817',\n",
" 'title': 'Brand sl',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 493.612823674476,\n",
" 'y': 0,\n",
" 'z': 2000,\n",
" 'width': 165.12946979038225,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': '842fbe1195501eb537a8',\n",
" 'title': 'Year-Month sl',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 0,\n",
" 'y': 0,\n",
" 'z': 5000,\n",
" 'width': 165.12946979038225,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': '344fe061214dca8e6566',\n",
" 'type': 'tableEx',\n",
" 'layout': {'x': 0,\n",
" 'y': 197.9778051787916,\n",
" 'z': 0,\n",
" 'width': 604.5869297163995,\n",
" 'height': 522.0221948212084,\n",
" 'displayState': {'mode': 0}}}]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"visuals = report.visuals_on_page('ReportSection519fb7909a3879a736a7')\n",
"visuals"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from io import StringIO"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"exported_data = report.export_visual_data('ReportSection519fb7909a3879a736a7', '344fe061214dca8e6566', rows=100, export_data_type=models.ExportDataType.SUMMARIZED.value)\n",
"dataexp=StringIO(exported_data)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
PBI_visualize = QuickVisualize(get_dataset_config(df), auth=device_auth)
At the stage I run "PBI_Visualize", it will attempt to display the the visual but then fails with:
"Uncaught DataCloneError: Failed to execute 'postMessage' on 'Window': CustomEvent object could not be cloned."
The error occurs in Azure Databricks
Please provide the options to export all rows from visual data without having to feed number to rows keyword.
export_visual_data(page_name, visual_name, rows=all_rows, export_data_type=models.ExportDataType.SUMMARIZED.value)
The documentation doesnt explain about it.
the set_active_page(page_name) does not work. is there a way a different way to change the active page?
Hi,
I have tried this library to embed report in jupyter notebooks. But I want to extract the data from report visuals in python script and run through commandline. Currently report is getting embedded after calling Report() on jupyter notebooks only. When i try to run the same thing in python script commandline it says report is not embedded.
Could you please suggest me some resource which i can use for reference to extract data from power report visuals in python .py script.
Hello all,
when install powerbiclient package, using this command "pip install powerbiclient"
this error is shown:
ERROR: Could not find a version that satisfies the requirement powerbiclient (from versions: none)
ERROR: No matching distribution found for powerbiclient
Best Regards.
I try to open the PowerBI report but it gives error
Exception Traceback (most recent call last)
Cell In[12], line 1
----> 1 pages = report.get_pages()
2 display(pages)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\powerbiclient\report.py:562, in Report.get_pages(self)
556 """Returns pages list of the embedded Power BI report
557
558 Returns:
559 list: list of pages
560 """
561 if not self._embedded:
--> 562 raise Exception(self.REPORT_NOT_EMBEDDED_MESSAGE)
564 # Start getting pages on client side
565 self._get_pages_request = True
Exception: Power BI report is not embedded
Link to documentation provided in the readme returns a 404
Rendering a report in Edge doesn't seem to work.
Run notebook in Edge, report won;t render. It is picked up, can see the report object attributes etc.
Same code runs and renders correctly in Chrome.
On rerunning the notebook in Edge the report will render.
Not tried with closing/restarting jupyter.
hi guys,
i'm trying to run a sample notebook with this code (same as the documentation sample).
from powerbiclient import Report, models
from powerbiclient.authentication import DeviceCodeLoginAuthentication
device_auth = DeviceCodeLoginAuthentication()
and I'm stucked on the following error
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)
already searched on countless pages to see if there would be something that helps me in this. no success.
is there any way that we can ignore the SSL verification? Something like requests.get(url,verify=False)
Complete log error below.
---------------------------------------------------------------------------
SSLCertVerificationError Traceback (most recent call last)
c:\python39\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
698 # Make the request on the httplib connection object.
--> 699 httplib_response = self._make_request(
700 conn,
c:\python39\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
381 try:
--> 382 self._validate_conn(conn)
383 except (SocketTimeout, BaseSSLError) as e:
c:\python39\lib\site-packages\urllib3\connectionpool.py in _validate_conn(self, conn)
1009 if not getattr(conn, "sock", None): # AppEngine might not have `.sock`
-> 1010 conn.connect()
1011
c:\python39\lib\site-packages\urllib3\connection.py in connect(self)
410
--> 411 self.sock = ssl_wrap_socket(
412 sock=conn,
c:\python39\lib\site-packages\urllib3\util\ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir, key_password, ca_cert_data, tls_in_tls)
427 if send_sni:
--> 428 ssl_sock = _ssl_wrap_socket_impl(
429 sock, context, tls_in_tls, server_hostname=server_hostname
c:\python39\lib\site-packages\urllib3\util\ssl_.py in _ssl_wrap_socket_impl(sock, ssl_context, tls_in_tls, server_hostname)
471 if server_hostname:
--> 472 return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
473 else:
c:\python39\lib\ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
499 # ctx._wrap_socket()
--> 500 return self.sslsocket_class._create(
501 sock=sock,
c:\python39\lib\ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
1039 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
-> 1040 self.do_handshake()
1041 except (OSError, ValueError):
c:\python39\lib\ssl.py in do_handshake(self, block)
1308 self.settimeout(None)
-> 1309 self._sslobj.do_handshake()
1310 finally:
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
c:\python39\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
438 if not chunked:
--> 439 resp = conn.urlopen(
440 method=request.method,
c:\python39\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
782 )
--> 783 return self.urlopen(
784 method,
c:\python39\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
754
--> 755 retries = retries.increment(
756 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
c:\python39\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
572 if new_retry.is_exhausted():
--> 573 raise MaxRetryError(_pool, url, error or ResponseError(cause))
574
MaxRetryError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /organizations/v2.0/.well-known/openid-configuration (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last)
<ipython-input-21-89c3807efee2> in <module>
6
7 # Initiate device authentication
----> 8 device_auth = DeviceCodeLoginAuthentication()
c:\python39\lib\site-packages\powerbiclient\authentication.py in __init__(self, client_id, scopes, tenant)
109 scopes = DEFAULT_SCOPES
110 self.scopes = scopes
--> 111 auth_result = self._acquire_token_device_code()
112 super().__init__(client_id, scopes, self.authority_uri, auth_result)
113
c:\python39\lib\site-packages\powerbiclient\authentication.py in _acquire_token_device_code(self)
118 dict: authentication result
119 """
--> 120 app = msal.PublicClientApplication(client_id=self.client_id, authority=self.authority_uri)
121 flow = app.initiate_device_flow(self.scopes)
122
c:\python39\lib\site-packages\msal\application.py in __init__(self, client_id, client_credential, **kwargs)
1294 if client_credential is not None:
1295 raise ValueError("Public Client should not possess credentials")
-> 1296 super(PublicClientApplication, self).__init__(
1297 client_id, client_credential=None, **kwargs)
1298
c:\python39\lib\site-packages\msal\application.py in __init__(self, client_id, client_credential, authority, validate_authority, token_cache, http_client, verify, proxies, timeout, client_claims, app_name, app_version, client_capabilities, azure_region, exclude_scopes)
294 # Here the self.authority will not be the same type as authority in input
295 try:
--> 296 self.authority = Authority(
297 authority or "https://login.microsoftonline.com/common/",
298 self.http_client, validate_authority=validate_authority)
c:\python39\lib\site-packages\msal\authority.py in __init__(self, authority_url, http_client, validate_authority)
81 ))
82 try:
---> 83 openid_config = tenant_discovery(
84 tenant_discovery_endpoint,
85 self.http_client)
c:\python39\lib\site-packages\msal\authority.py in tenant_discovery(tenant_discovery_endpoint, http_client, **kwargs)
140 def tenant_discovery(tenant_discovery_endpoint, http_client, **kwargs):
141 # Returns Openid Configuration
--> 142 resp = http_client.get(tenant_discovery_endpoint, **kwargs)
143 if resp.status_code == 200:
144 payload = json.loads(resp.text) # It could raise ValueError
c:\python39\lib\site-packages\requests\sessions.py in get(self, url, **kwargs)
553
554 kwargs.setdefault('allow_redirects', True)
--> 555 return self.request('GET', url, **kwargs)
556
557 def options(self, url, **kwargs):
c:\python39\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
540 }
541 send_kwargs.update(settings)
--> 542 resp = self.send(prep, **send_kwargs)
543
544 return resp
c:\python39\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
653
654 # Send the request
--> 655 r = adapter.send(request, **kwargs)
656
657 # Total elapsed time of the request (approximately)
c:\python39\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
512 if isinstance(e.reason, _SSLError):
513 # This branch is for urllib3 v1.22 and later.
--> 514 raise SSLError(e, request=request)
515
516 raise ConnectionError(e, request=request)
SSLError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /organizations/v2.0/.well-known/openid-configuration (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))
Hi , I am trying to Embed PBI report through Service Principal Authentication . but i am getting error as "LoadReportFailed - Fail to initialize - Could not resolve cluster"
Please assist
If I created a dashboard and defined different groups who can access the dashboard, will I be able to view the dashboard as how each group would see it? That is, can I view the dashboard with different RLS filters applied?
Has anyone successfully been able to display a report under VS Code?
My setup:
I successfully get device authentication. When I try to render a report:
I click on enable, then restart kernel, authenticate again but keep getting the same error.
Hi team,
I have a Power BI report with multiple report tabs and the data I want to extract from a table is not on the active page by default. Is there an ability to set the active page to a page with a known page id through coding? I am aware it is possible by manually selecting the tab from the embedded visual but my goal is to eliminate this manual step by writing a code to switch to another page automatically.
Hi
I am trying to use powerbi-jupyter client in Microsoft Fabric Notebook (which are feature identical to Synapse Notebooks if I'm not mistaken).
I use following code:
# Setup for getting data from PowerBI
from powerbiclient import Report, models, authentication
# Authenticate to Power BI service using InteractiveLoginAuthentication
auth = authentication.DeviceCodeLoginAuthentication()
# Configure view mode
view_mode=models.EmbedMode.VIEW.value
# NewSales Report configuration
group_id = "GROUP-GUID"
report_id = "REPORT-GUID"
# Create a Power BI report object
report = Report(group_id=group_id, report_id=report_id, auth=auth)
report
The report does not render.
Any idea what can be done to make this work in Microsoft Fabric?
Hello, is it normal that the report display doesn't update when you apply a filter and do an update_filters?
when I am trying to use dropdown slicer with single select option it is not able to select and report coming as blank
def filter_report(filter_list1,filter_list2):
region_filter1 = {
'$schema': "http://powerbi.com/product/schema#basic",
'target': {
'table': "Roadmap_Allviewers",
'column': "Brand_divided"
},
'operator': "In",
'values': [filter_list1]
}
region_filter2 = {
'$schema': "http://powerbi.com/product/schema#basic",
'target': {
'table': "Roadmap_Allviewers",
'column': "Workstream"
},
'operator': "In",
'values': [filter_list2]
}
report.remove_filters()
report.update_filters([region_filter1,region_filter2])
The link to "Documentation" and "Demo Notebook" are broken on this page: https://github.com/microsoft/powerbi-jupyter/
The Documentation link points to : https://github.com/microsoft/powerbi-jupyter/blob/main/%5CDOCUMENTATION.md
correct link : https://github.com/microsoft/powerbi-jupyter/blob/main/DOCUMENTATION.md
Demo Notebook points to : https://github.com/microsoft/powerbi-jupyter/blob/main/\demo\demo.ipynb
Correct link : https://github.com/microsoft/powerbi-jupyter/blob/main/demo/demo.ipynb
Please fix.
Great work on this, thank you so much!
How do I resize the embedded dashboard in Jupyter notebook? I did not see any arguments to specify the width and height. Can you please point to it if it exists, if not that would be a feature request. Thanks!
Hello,
Have you ever managed to recover the value of a visual please?
Greetings--
I have had success running the demo code in a jupyter notebook launched via jupyter notebook
. However, the very same demo code (in the exact same notebook that worked before!) fails when attempting to render the report when launched within Jupyter Lab. In place of rendering the embedded report, the cell instead outputs this generic Jupyter widget-fail message: "Error displaying widget: model not found"
I have followed the special installation instructions provided in the README for Jupyter Lab both in existing and brand new conda environments. In the Jupyter Lab UI, the extension shows as being installed and activated. The txt file attached documents a "fresh" conda environment with the package and lab extensions installed and jupyter lab successfully built, but where I'm still seeing the error. I'm working in a relatively new and updated Windows 10 environment.
Love this package! . . . and hope you can help me get it to run in Jupyter Lab. Thank you!
Steve
pbi_env.txt
Using JupyterLab v3.6.1 the widget control does not load.
https://ipywidgets.readthedocs.io/en/stable/user_install.html#frequently-asked-questions
Hello,
I'm currently trying to follow your demos for you powerbi widgets for jupyter.
Specifically I am running the Visualize with Power BI demo.ipynb.
I have followed the instructions for jupyter lab but if I attempt to run the following
code
# Create a Power BI report from your data
PBI_visualize = QuickVisualize(get_dataset_config(df), auth=device_auth)
PBI_visualize
I get the following error
[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'QuickVisualizeModel' from module 'powerbi-jupyter-client'
loadClass@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.a63a8d293fb35a52dc25.js?v=a63a8d293fb35a52dc25:1:74936
loadModelClass@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.ebc7a55ea1768712771f.js?v=ebc7a55ea1768712771f:1:10729
_make_model@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.ebc7a55ea1768712771f.js?v=ebc7a55ea1768712771f:1:7517
new_model@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.ebc7a55ea1768712771f.js?v=ebc7a55ea1768712771f:1:5137
handle_comm_open@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.ebc7a55ea1768712771f.js?v=ebc7a55ea1768712771f:1:3894
134/v/this._handleCommOpen@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.a63a8d293fb35a52dc25.js?v=a63a8d293fb35a52dc25:1:73473
_handleCommOpen@http://localhost:8888/static/lab/jlab_core.c2628bfc928bd194fa79.js?v=c2628bfc928bd194fa79:1:1240940
Following the instructionsn and inspecting the browser debugger gives
I am running the notebook via jupyter lab within a poetry environment.
The poetry.lock file is attached.
lock.txt
Any help would be appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.