Perform data analysis using Microsoft Fabric Notebooks

Applies to:SQL database in Microsoft Fabric

You can perform analysis on your data using many tools, such as the Power BI report you created in the last step of this tutorial. Another popular tool for analysis is Jupyter Notebooks. Notebooks are a Python-based item that contains cells that hold either code or plain text (as Markdown, a rich text formatting language for plain text). The code that runs is based on the Kernel, or environment, of the Jupyter Notebook. Microsoft Fabric contains Notebooks and multiple environments for the code cells.

In our sample tutorial, your organization has asked that you set up a Notebook for the data in your SQL data. We'll use the SQL analytics endpoint of your SQL database, which contains automatically replicated data from your SQL database.

Prerequisites

  • Complete all the previous steps in this tutorial.

Data analysis with T-SQL notebooks

  1. Navigate to the Workspace you created for this tutorial from the Home of your Microsoft Fabric portal.

  2. Select the New Item button in the tool bar, and then select All items and scroll until you see a Notebook item. Select that item to create a new Notebook.

  3. In the icon bar, change the environment from PySpark (Python) to T-SQL.

    Screenshot shows changing the kernel, or environment, of the Notebook to T-SQL.

  4. In each code cell, there is a drop-down list for the code language. In the first cell in the Notebook, change the code language from PySpark (Python) to T-SQL.

    Screenshot shows changing the code cell language to T-SQL.

  5. In the Notebook Explorer, select the Warehouses item.

    Screenshot showing the Notebook Explorer.

  6. Select the + Warehouses button.

    Screenshot shows adding a Warehouse to the Data Sources.

  7. Select the SQL analytics endpoint object that is named supply_chain_analytics_database, with the same name of the object you created earlier in this tutorial. Select Confirm.

  8. Expand the database, expand Schemas. Expand the SupplyChain schema. Expand Views, and locate the SQL view named vProductsBySupplier.

  9. Select the ellipses next to that view. and select the option that says SELECT TOP 100.

    Screenshot shows how to drill down to vProductsBySupplier and SELECT TOP 100.

  10. This creates a cell with T-SQL code that has the statements pre-populated for you. Select the Run Cell button for the cell to run the query and return the results.

    Screenshot shows the results of the SELECT TOP 100 query.

  11. In the results, you can see not only the data requested, but buttons that allow you to view charts, save the data as another table, download, and more. To the side of the results you can see a new pane with quick inspection of the data elements, showing minimum and maximum values, missing data, and unique counts of the data returned.

  12. Hovering between the code cells shows you a menu to add another cell. Select the + Markdown button.

    Screenshot from a Notebook showing the interface to a new markdown cell.

  13. This places a text-based field where you can add information. Styling for the text is available in the icon bar, or you can select the </> button to work with Markdown directly. The result of the formatting show as a preview of the formatted text.

    Screenshot the preview of markdown formatted plain text in a Notebook.

  14. Select the Save As icon in the ribbon. Enter the text products_by_suppliers_notebook. Ensure you set the location to your tutorial Workspace. Select the Save button to save the notebook.

Next step