次の方法で共有


report Package

Functions

clone_report

Clone a report in the specified workspace.

Note

This functions wraps the PowerBI REST API Reports - Clone Report In Group.

clone_report(source_report: str | UUID, target_report: str, source_workspace: str | UUID | None = None, target_workspace: str | UUID | None = None, target_dataset: str | UUID | None = None, target_dataset_workspace: str | UUID | None = None, credential: TokenCredential | None = None) -> str

Parameters

Name Description
source_report
Required
str or UUID

Source report name or ID.

target_report
Required
str

Target report name.

source_workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID that hosts the source report. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Default value: None
target_workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID that will host the cloned report. If None, the cloned report will be created in the same workspace as the source report.

Default value: None
target_dataset
str or UUID

Target semantic model name or ID. If None, the cloned report will be bound to the same dataset as the source report.

Default value: None
target_dataset_workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID that hosts the target dataset. If None, the target dataset workspace will be assumed to be the same workspace as the source report.

Default value: None
credential
<xref:sempy.fabric.report.TokenCredential>

The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used.

Default value: None

Returns

Type Description
str

The ID of the cloned report.

get_report_json

Get the report.json content of a Power BI report in PBIR-Legacy format.

This function retrieves the report definition and extracts the report.json file, which contains the layout, visuals, and configuration of the report.

Note

This function wraps the Fabric REST API

Items - Get Report Definition.

Only reports in the PBIR-Legacy format are supported.

get_report_json(report: str | UUID, workspace: str | UUID | None = None, credential: TokenCredential | None = None) -> dict

Parameters

Name Description
report
Required
str or UUID

Name or ID of the Power BI report.

workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Default value: None
credential
<xref:sempy.fabric.report.TokenCredential>

The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used.

Default value: None

Returns

Type Description

The report.json content as a dictionary.

Exceptions

Type Description

If the report.json file cannot be found in the report definition. This typically means the report is not in PBIR-Legacy format.

list_reports

Return a list of reports in the specified workspace.

list_reports(workspace: str | UUID | None = None, endpoint: Literal['powerbi', 'fabric'] = 'powerbi', credential: TokenCredential | None = None) -> pd.DataFrame

Parameters

Name Description
workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Default value: None
endpoint
<xref:Literal>[<xref:”powerbi”, "fabric"]

The endpoint to use for listing reports. Supported values are "powerbi" and "fabric". See PowerBI List Reports for using "powerbi" and Fabric List Reports for using "fabric".

Default value: powerbi
credential
<xref:sempy.fabric.report.TokenCredential>

The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used.

Default value: None

Returns

Type Description
"<xref:pd.DataFrame>"

DataFrame with one row per report.

rebind_report

Rebind one or more reports to a semantic model.

Note

This functions wraps the PowerBI REST API Reports - Rebind Report In Group.

rebind_report(report: str | UUID | List[str | UUID], dataset: str | UUID, report_workspace: str | UUID | None = None, dataset_workspace: str | UUID | None = None, credential: TokenCredential | None = None) -> None

Parameters

Name Description
report
Required
str, UUID or <xref:sempy.fabric.report.a list> of str or UUID

Report name(s) or ID(s).

dataset
Required
str or UUID

Target semantic model name or ID.

report_workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID that hosts the report(s). Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Default value: None
dataset_workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID that hosts the semantic model. Defaults to report_workspace.

Default value: None
credential
<xref:sempy.fabric.report.TokenCredential>

The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used.

Default value: None

update_report_from_reportjson

Update a report's layout and configuration using a report.json dictionary.

This function retrieves the existing report definition to preserve the definition.pbir file, then updates the report.json portion with the provided dictionary.

Note

This function wraps the Fabric REST API

Items - Update Report Definition.

Only reports in the PBIR-Legacy format are supported.

update_report_from_reportjson(report: str | UUID, report_json: dict, workspace: str | UUID | None = None, credential: TokenCredential | None = None) -> None

Parameters

Name Description
report
Required
str or UUID

Name or ID of the Power BI report.

report_json
Required

The report.json content to apply to the report.

workspace
str or UUID

The Fabric workspace name or UUID object containing the workspace ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Default value: None
credential
<xref:sempy.fabric.report.TokenCredential>

The credential for token acquisition. Must be an instance of azure.core.credentials.TokenCredential. If None, the default credential will be used.

Default value: None

Exceptions

Type Description

If the definition.pbir file cannot be found in the existing report definition.

If the API request fails.