Microsoft Fabric empowers real-time analytics and data processing, and one of its essential features is the KQL Queryset. In this blog post, we’ll delve into what KQL Querysets are, how to create them, and their significance in querying data from KQL databases.
What is a KQL Queryset?
A KQL Queryset serves as a bridge between you and your data. It allows you to:
- Run Queries: Execute queries on data from a KQL database.
- Customize Results: View and customize query results.
- No-Code Experience: Create queries without writing complex code.
Prerequisites
Before diving into KQL Querysets, ensure you have the following:
- A workspace with Microsoft Fabric-enabled capacity.
- A KQL database with editing permissions and data, or an Azure Data Explorer cluster and database with AllDatabaseAdmin permissions.
Creating a KQL Queryset
- Navigate to Your Workspace: Browse to the desired workspace where you want to create the KQL Queryset.
- Create a New Queryset:
- Click +New and select KQL Queryset.
- Enter a unique name (alphanumeric characters, underscores, periods, and hyphens are allowed).
- Click Create.
!Creating a KQL Queryset
Connecting to a Database
Queries run in the context of a database. You can associate your KQL queryset with either a KQL database or a database from an Azure Data Explorer cluster:
- KQL Database:
- Open your KQL queryset.
- Under Database, expand the database connections menu.
- Select OneLake data hub.
- Choose a KQL database from the list and click Select.
- Azure Data Explorer Cluster:
- Open your KQL queryset.
- Under Database, expand the database connections menu.
- Select Azure Data Explorer.
- Enter the cluster URI (found in the Azure portal).
- Select a database from the dropdown menu.
- Click Connect.
A list of tables associated with the selected database will appear below the database name.
Writing Queries
Now that you’re connected to your data source, let’s write some queries using the Kusto Query Language (KQL). For example, you can use publicly available data like the StormEvents.csv.
- Write or copy a query in the top pane of the KQL Queryset.
- Click the Run button or press Shift + Enter to execute the query.
- The query results will appear in the results grid below the query pane.
Notice the green check indicating a successful query execution and the time taken to compute the results.