{"cells":[{"cell_type":"markdown","id":"5c27dfd1-4fe0-4a97-92e6-ddf78889aa93","metadata":{"nteract":{"transient":{"deleting":false}}},"source":["### Install the latest .whl package\n","\n","Check [here](https://pypi.org/project/semantic-link-labs/) to see the latest version."]},{"cell_type":"code","execution_count":null,"id":"d5cae9db-cef9-48a8-a351-9c5fcc99645c","metadata":{"jupyter":{"outputs_hidden":true,"source_hidden":false},"nteract":{"transient":{"deleting":false}}},"outputs":[],"source":["%pip install semantic-link-labs"]},{"cell_type":"markdown","id":"b195eae8","metadata":{},"source":["### Import the library and necessary packages"]},{"cell_type":"code","execution_count":null,"id":"1344e286","metadata":{},"outputs":[],"source":["import sempy_labs as labs\n","import sempy_labs.report as rep"]},{"cell_type":"markdown","id":"5a3fe6e8-b8aa-4447-812b-7931831e07fe","metadata":{"nteract":{"transient":{"deleting":false}}},"source":["### Collect semantic model Best Practice Analyzer stats"]},{"cell_type":"markdown","id":"8702e95b","metadata":{},"source":["#### Collect stats for all semantic models within a single workspace"]},{"cell_type":"code","execution_count":null,"id":"9e349954","metadata":{},"outputs":[],"source":["labs.run_model_bpa_bulk(workspace='Workspace 1')"]},{"cell_type":"markdown","id":"8281d30d","metadata":{},"source":["#### Collect stats for all semantic models within a list of workspaces"]},{"cell_type":"code","execution_count":null,"id":"d6b09b86","metadata":{},"outputs":[],"source":["labs.run_model_bpa_bulk(workspace=['Workspace 1', 'Workspace 2'])"]},{"cell_type":"markdown","id":"ec9109e4","metadata":{},"source":["#### Collect stats for all semantic models within all accessible workspaces"]},{"cell_type":"code","execution_count":null,"id":"e08860da","metadata":{},"outputs":[],"source":["labs.run_model_bpa_bulk(workspace=None)"]},{"cell_type":"markdown","id":"113b04a7","metadata":{},"source":["#### Create a Direct Lake semantic model (called 'ModelBPA') for analyzing the Best Practice Analyzer results"]},{"cell_type":"code","execution_count":null,"id":"b4e1296b","metadata":{},"outputs":[],"source":["labs.create_model_bpa_semantic_model()"]},{"cell_type":"markdown","id":"7f94b13a","metadata":{},"source":["#### Create a Power BI report called 'ModelBPA' based semantic model created in the previous cell, which can be used to analyze the Best Practice Analyzer results"]},{"cell_type":"code","execution_count":null,"id":"17565d35","metadata":{},"outputs":[],"source":["rep.create_model_bpa_report()"]},{"cell_type":"markdown","id":"d41bdae4","metadata":{},"source":["<div class=\"alert alert-block alert-info\">\n","<b>Note:</b> The 'BPAReport' Power BI report is located within the workspace in which the default lakehouse attached to this notebook resides. Navigate to this workspace to open the report and view the Best Practice Analyzer results.\n","</div>\n","\n","Going forward, you just need to run the 'run_model_bpa_bulk' function which will append BPA results to the 'modelbparesults' delta table in your lakehouse. Since the 'BPAModel' semantic model is in Direct Lake mode, the data will appear in the semantic model and report automatically without any need for processing the semantic model.\n","\n"]}],"metadata":{"kernel_info":{"name":"synapse_pyspark"},"kernelspec":{"display_name":"Synapse PySpark","language":"Python","name":"synapse_pyspark"},"language_info":{"name":"python"},"microsoft":{"language":"python"},"nteract":{"version":"nteract-front-end@1.0.0"},"spark_compute":{"compute_id":"/trident/default"},"synapse_widget":{"state":{},"version":"0.1"},"widgets":{}},"nbformat":4,"nbformat_minor":5}