title | description | author | ms.author | ms.reviewer | ms.date | ms.service | ms.topic |
---|---|---|---|---|---|---|---|
Notebooks with Kusto Kernel in Azure Data Studio |
This tutorial shows how you can create and run a Kusto notebook. |
markingmyname |
maghan |
jukoesma |
09/22/2020 |
azure-data-studio |
how-to |
This article shows you how to create and run an Azure Data Studio notebook using the Kusto (KQL) extension, connecting to an Azure Data Explorer cluster.
With the Kusto (KQL) extension, you can change the kernel option to Kusto.
This feature is currently in preview.
If you don't have an Azure subscription, create a free Azure account before you begin.
- An Azure Data Explorer cluster with a database that you can connect to.
- Azure Data Studio.
- Kusto (KQL) extension for Azure Data Studio.
The following steps show how to create a notebook file in Azure Data Studio:
-
In Azure Data Studio, connect to your Azure Data Explorer cluster.
-
Navigate to the Connections pane and under the Servers window, right-click the Kusto database and select New Notebook. You can also go to File > New Notebook.
:::image type="content" source="media/notebooks-kusto-kernel/kusto-new-notebook.png" alt-text="Open notebook":::
-
Select Kusto for the Kernel. Confirm that the Attach to menu is set to the cluster name and database. For this article, we use the help.kusto.windows.net cluster with the Samples database data.
:::image type="content" source="media/notebooks-kusto-kernel/set-kusto-kernel.png" alt-text="Set Kernel and Attach to":::
You can save the notebook using the Save or Save as... command from the File menu.
To open a notebook, you can use the Open file... command in the File menu, select Open file on the Welcome page, or use the File: Open command from the command palette.
To change the Kusto connection for a notebook:
-
Select the Attach to menu from the notebook toolbar and then select Change Connection.
:::image type="content" source="media/notebooks-kusto-kernel/kusto-select-attach-to-change-connections.png" alt-text="change connections":::
[!Note] Ensure that the database value is populated. Kusto notebooks require to have the database specified.
-
Now you can either select a recent connection server or enter new connection details to connect.
:::image type="content" source="media/notebooks-kusto-kernel/kusto-change-connection.png" alt-text="Select a different cluster":::
[!Note] Specify the cluster name without the
https://
.
You can create cells containing KQL queries that you can run in place by selecting the Run cell button to the cell's left. The results are shown in the notebook after the cell runs.
For example:
-
Add a new code cell by selecting the +Code command in the toolbar.
:::image type="content" source="media/notebooks-kusto-kernel/kusto-kernel-code.png" alt-text="Kusto kernel code block":::
-
Copy and paste the following example into the cell and select Run cell. This example queries the StormEvents data for a specific event type.
StormEvents | where EventType == "Waterspout"
:::image type="content" source="media/notebooks-kusto-kernel/run-kusto-notebook-cell.png" alt-text="Run cell":::
If you run a script that returns a result, you can save that result in different formats using the toolbar displayed above the result.
- Save As CSV
- Save As Excel
- Save As JSON
- Save As XML
- Show Chart
StormEvents
| limit 10
:::image type="content" source="media/notebooks-kusto-kernel/run-notebook-save-results.png" alt-text="Save result":::
You can file a feature request to provide feedback to the product team.
You can file a bug to provide feedback to the product team.
Learn more about notebooks: