{"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 set the initial parameters"]},{"cell_type":"code","execution_count":null,"id":"1344e286","metadata":{},"outputs":[],"source":["import sempy.fabric as fabric\n","import sempy_labs as labs\n","dataset = '' # Enter your dataset name\n","workspace = None # Enter your workspace name (if set to None it will use the workspace in which the notebook is running)"]},{"cell_type":"markdown","id":"5a3fe6e8-b8aa-4447-812b-7931831e07fe","metadata":{"nteract":{"transient":{"deleting":false}}},"source":["### Refresh a semantic model"]},{"cell_type":"code","execution_count":null,"id":"9e349954","metadata":{},"outputs":[],"source":["labs.refresh_semantic_model(dataset=dataset, workspace=workspace)"]},{"cell_type":"markdown","id":"65db8187","metadata":{},"source":["#### Visualize the refresh of a semantic model\n","The resulting dataframe returns the trace logs capturing the details of the refresh operation"]},{"cell_type":"code","execution_count":null,"id":"24de391e","metadata":{},"outputs":[],"source":["df = labs.refresh_semantic_model(dataset=dataset, workspace=workspace, visualize=True)"]},{"cell_type":"markdown","id":"113b04a7","metadata":{},"source":["#### Refresh specific tables"]},{"cell_type":"code","execution_count":null,"id":"b4e1296b","metadata":{},"outputs":[],"source":["labs.refresh_semantic_model(dataset=dataset, workspace=workspace, tables=['Sales', 'Geography'])"]},{"cell_type":"markdown","id":"7f94b13a","metadata":{},"source":["#### Refresh specific partitions"]},{"cell_type":"code","execution_count":null,"id":"17565d35","metadata":{},"outputs":[],"source":["labs.refresh_semantic_model(dataset=dataset, workspace=workspace, partitions=[\"'Sales'[Sales FY20]\", \"'Sales'[Sales FY21]\"])"]},{"cell_type":"markdown","id":"aab5ca7c","metadata":{},"source":["#### Refresh a combination of tables and partitions"]},{"cell_type":"code","execution_count":null,"id":"e5818bd1","metadata":{},"outputs":[],"source":["labs.refresh_semantic_model(dataset=dataset, workspace=workspace, tables=['Geography', 'Calendar'], partitions=[\"'Sales'[Sales FY20]\", \"'Sales'[Sales FY21]\"])"]},{"cell_type":"markdown","id":"7f7074ea","metadata":{},"source":["#### Clear the values of a table"]},{"cell_type":"code","execution_count":null,"id":"3b1eb772","metadata":{},"outputs":[],"source":["labs.refresh_semantic_model(dataset=dataset, workspace=workspace, refresh_type='clearValues')"]},{"cell_type":"markdown","id":"29afede1","metadata":{},"source":["### View semantic model refreshes"]},{"cell_type":"code","execution_count":null,"id":"95c52cc0","metadata":{},"outputs":[],"source":["fabric.list_refresh_requests(dataset=dataset, workspace=workspace)"]},{"cell_type":"markdown","id":"fa7c525c","metadata":{},"source":["### Cancel a semantic model refresh"]},{"cell_type":"code","execution_count":null,"id":"5bb6f79f","metadata":{},"outputs":[],"source":["labs.cancel_dataset_refresh(dataset=dataset, workspace=workspace)"]},{"cell_type":"code","execution_count":null,"id":"acd34900","metadata":{},"outputs":[],"source":["# Specify the request_id based on a value from list_refresh_requests\n","labs.cancel_dataset_refresh(dataset=dataset, workspace=workspace, request_id='')"]},{"cell_type":"markdown","id":"26300103","metadata":{},"source":["### View a semantic model's refresh history"]},{"cell_type":"code","execution_count":null,"id":"60cec3f8","metadata":{},"outputs":[],"source":["labs.get_semantic_model_refresh_history(dataset=dataset, workspace=workspace)"]},{"cell_type":"markdown","id":"538d5f1e","metadata":{},"source":["### View details of a specific semantic model refresh"]},{"cell_type":"code","execution_count":null,"id":"c043f9bc","metadata":{},"outputs":[],"source":["labs.get_semantic_model_refresh_history(dataset=dataset, workspace=workspace, request_id='')"]}],"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}