Query data in a KQL queryset

In this article, you learn how to use a KQL queryset. The KQL Queryset is the item used to run queries, view, and customize query results on data from a KQL database.

The KQL Queryset uses the Kusto Query Language for creating queries, and also supports many SQL functions. For more information about the query language, see Kusto Query Language overview.


Select a database

Queries run in the context of a database. You can change the associated database at any point, and retain the queries saved in the query editor. You can associate your KQL queryset with a KQL database or a database from an Azure Data Explorer cluster.

Select the tab that corresponds with your desired database type.

  1. Open your KQL queryset.

  2. Under Database, select V to expand the database connections menu.

    Screenshot of the database menu showing a list of connected databases.

  3. Under Connect source, select OneLake data hub.

  4. In the OneLake data hub window that appears, select a KQL database, and then select Select.

    Screenshot of the OneLake data hub window showing a selected KQL database.

A list of tables associated with this database appears below the database name.

Write a query

Now that you're connected to your data source, you can run queries on this data. The KQL Queryset uses the Kusto Query Language (KQL) to query data from any of the databases you have access to. To learn more about KQL, see Kusto Query Language overview.

The following examples use data that is publicly available at https://kustosamples.blob.core.windows.net/samplefiles/StormEvents.csv.

  1. Write or copy a query in the top pane of the KQL Queryset.

  2. Select the Run button, or press Shift+Enter to run the query.

    The resulting query output is displayed in the results grid, which appears below the query pane. Notice the green check indicating that the query has finished successfully, and time used to compute the query results.

    Screenshot of the KQL Queryset showing the results of a query. Both the query and the results pane are highlighted.

Manage queryset tabs

Within a KQL queryset, you can create multiple tabs. Each tab can be associated with a different KQL database, and lets you save queries for later use or share with others to collaborate on data exploration. You can also change the KQL database associated with any tab, allowing you to run the same query on data in different states.

Screenshot of the options for editing tabs in the KQL Queryset.

  • Rename a tab: Select the pencil icon next to the tab name.
  • Add a new tab: Select the plus + to the right of the existing tabs. Different tabs can be connected to different databases.
  • Change the existing database connection: Under Database, select the existing database connection to open the data hub.

Copy query

You might want to copy or share the queries you create.

  1. At the top of the query window, select the Home tab.

  2. Select Copy query.

    Screenshot of the Manage tab of the KQL Queryset showing the dropdown of the copy query or query results option.

    The following table outlines the many options for how to share a query.


    The user who is receiving the query link must have viewing permissions to the underlying data to execute the query and view results.

    Action Description
    Copy query Copy the query text.
    Link to clipboard Copy a deep link that can be used to run the query.
    Link and query to clipboard Copy a link that can be used to run the query and the text of the query.
    Link, query and results to clipboard Copy a link that can be used to run the query, the text of the query, and the results of the query.
    Copy results Copy the results of the query.
  3. Select the desired sharing action from the above table.

  4. Paste this information into any editor, such as Microsoft Word.

Export query data as CSV

Instead of simply copy-pasting the query output, you can also export the query results.

This is a one-time method to export a CSV file containing the query results.

  1. At the top of the query window, select the Home tab.

    Screenshot of the Home tab of the KQL Queryset showing the highlighted option to export results to CSV.

  2. Select Export results to CSV.

  3. Save the CSV file locally.

Delete KQL queryset

To delete your KQL queryset:

  1. Select the workspace to which your KQL queryset is associated.

  2. Hover over the KQL queryset you wish to delete. Select More [...], then select Delete.

    Screenshot of Microsoft Fabric workspace showing how to delete a KQL queryset.

Next step