Create and run a Kusto (KQL) notebook (Preview)
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.
Create a Kusto (KQL) notebook
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.
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.
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.
Change the connection
To change the Kusto connection for a notebook:
Select the Attach to menu from the notebook toolbar and then select Change Connection.
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.
Specify the cluster name without the
Run a code cell
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.
Add a new code cell by selecting the +Code command in the toolbar.
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"
Save the result or show chart
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
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:
Submit and view feedback for