sempy_labs.report package
Module contents
- sempy_labs.report.clone_report(report: str, cloned_report: str, workspace: str | None = None, target_workspace: str | None = None, target_dataset: str | None = None, target_dataset_workspace: str | None = None)
Clones a Power BI report.
- Parameters:
report (str) – Name of the Power BI report.
cloned_report (str) – Name of the new Power BI report.
workspace (str, default=None) – The Fabric workspace name. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.
target_workspace (str, default=None) – The name of the Fabric workspace to place the cloned 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.
target_dataset (str, default=None) – The name of the semantic model to be used by the cloned report. Defaults to None which resolves to the semantic model used by the initial report.
target_dataset_workspace (str, default=None) – The workspace in which the semantic model to be used by the report resides. Defaults to None which resolves to the semantic model used by the initial report.
- sempy_labs.report.create_model_bpa_report(report: str | None = 'ModelBPA', dataset: str | None = 'ModelBPA', dataset_workspace: str | None = None)
Dynamically generates a Best Practice Analyzer report for analyzing semantic models.
- Parameters:
report (str, default='ModelBPA') – Name of the report. Defaults to ‘ModelBPA’.
dataset (str, default='ModelBPA') – Name of the semantic model which feeds this report. Defaults to ‘ModelBPA’
dataset_workspace (str, default=None) – The Fabric workspace name in which the semantic model resides. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.
- sempy_labs.report.create_report_from_reportjson(report: str, dataset: str, report_json: dict, theme_json: dict | None = None, workspace: str | None = None)
Creates a report based on a report.json file (and an optional themes.json file).
- Parameters:
report (str) – Name of the report.
dataset (str) – Name of the semantic model to connect to the report.
report_json (dict) – The report.json file to be used to create the report.
theme_json (dict, default=None) – The theme.json file to be used for the theme of the report.
workspace (str, default=None) – The Fabric workspace name. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.
- sempy_labs.report.export_report(report: str, export_format: str, file_name: str | None = None, bookmark_name: str | None = None, page_name: str | None = None, visual_name: str | None = None, report_filter: str | None = None, workspace: str | None = None)
Exports a Power BI report to a file in your lakehouse.
- Parameters:
report (str) – Name of the Power BI report.
export_format (str) – The format in which to export the report. For image formats, enter the file extension in this parameter, not ‘IMAGE’. Valid formats
file_name (str, default=None) – The name of the file to be saved within the lakehouse. Do not include the file extension. Defaults ot the reportName parameter value.
bookmark_name (str, default=None) – The name (GUID) of a bookmark within the report.
page_name (str, default=None) – The name (GUID) of the report page.
visual_name (str, default=None) – The name (GUID) of a visual. If you specify this parameter you must also specify the page_name parameter.
report_filter (str, default=None) – A report filter to be applied when exporting the report. Syntax is user-friendly. See above for examples.
workspace (str, default=None) – The Fabric workspace name. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.
- sempy_labs.report.get_report_definition(report: str, workspace: str | None = None) DataFrame
Gets the collection of definition files of a report.
- Parameters:
- Returns:
The collection of report definition files within a pandas dataframe.
- Return type:
- sempy_labs.report.get_report_json(report: str, workspace: str | None = None, save_to_file_name: str | None = None) dict
Gets the report.json file content of a Power BI report.
- Parameters:
report (str) – Name of the Power BI report.
workspace (str, default=None) – The Fabric workspace name in which the report exists. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.
save_to_file_name (str, default=None) – Specifying this parameter will save the report.json file to the lakehouse attached to the notebook with the file name of this parameter.
- Returns:
The report.json file for a given Power BI report.
- Return type:
- sempy_labs.report.launch_report(report: str, workspace: str | None = None)
Shows a Power BI report within a Fabric notebook.
- Parameters:
- Returns:
An embedded Power BI report within the notebook.
- Return type:
- sempy_labs.report.report_rebind(report: str | List[str], dataset: str, report_workspace: str | None = None, dataset_workspace: str | None = None)
Rebinds a report to a semantic model.
- Parameters:
report (str | List[str]) – Name(s) of the Power BI report(s).
dataset (str) – Name of the semantic model.
report_workspace (str, default=None) – The name of the Fabric workspace in which the report resides. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.
dataset_workspace (str, default=None) – The name of the Fabric workspace in which the semantic model resides. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.
- sempy_labs.report.report_rebind_all(dataset: str, new_dataset: str, dataset_workspace: str | None = None, new_dataset_workpace: str | None = None, report_workspace: str | List[str] | None = None)
Rebinds all reports across all workspaces which are bound to a specific semantic model to a new semantic model.
- Parameters:
dataset (str) – Name of the semantic model currently binded to the reports.
new_dataset (str) – Name of the semantic model to rebind to the reports.
dataset_workspace (str, default=None) – The name of the Fabric workspace in which the original semantic model resides. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.
new_dataset_workspace (str, default=None) – The name of the Fabric workspace in which the new semantic model resides. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.
report_workspace (str | List[str], default=None) – The name(s) of the Fabric workspace(s) in which the report(s) reside(s). Defaults to None which finds all reports in all workspaces which use the semantic model and rebinds them to the new semantic model.
- sempy_labs.report.update_report_from_reportjson(report: str, report_json: dict, workspace: str | None = None)
Updates a report based on a report.json file.
- Parameters:
report (str) – Name of the report.
report_json (dict) – The report.json file to be used to update the report.
workspace (str, default=None) – The Fabric workspace name in which the report resides. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.