Use Copilot code completion in Microsoft Fabric's Data Warehouse

Completed

Copilot in Fabric for Data Warehouse provides context-based T-SQL code suggestions directly in the query editor. It uses your warehouse schema and query context to offer inline completions, from finishing a line to generating larger code blocks. It can help you write SQL, reduce repetitive typing, and catch some errors. Whether you're new to SQL or experienced, Copilot can assist with routine code so you can focus on design and optimization tasks.

Prerequisites

To get started, ensure your administrator has enabled the Copilot tenant switch and that your capacity is in a supported region. Paid SKUs (F2 or higher or a P SKU) are required, as trial SKUs aren't supported. If your tenant settings restrict data processing to specific geographic regions, confirm that the necessary permissions are enabled.

Next, make sure you have a warehouse created in your Fabric workspace. In this learn module, we'll use the sample warehouse provided by Microsoft.

How to use Copilot code completion

Start typing your query in the SQL editor, and Copilot provides real-time suggestions as dimmed ghost text. You can accept a suggestion by pressing Tab or dismiss it by continuing to type. If you prefer to accept only part of a suggestion, use the Ctrl+Right shortcut (Cmd+Right on macOS) to accept the next word. Copilot also offers alternative suggestions for the same input, which you can preview by hovering over the suggestion and selecting the best fit.

Screenshot of Fabric Data Warehouse Query Editor with Copilot Code completion.

To guide Copilot, you can leave comments in your query using --. For example, writing -- What is the distribution of trips by hour on working days (non-holiday weekdays)? prompts Copilot to generate a corresponding query. This approach helps you write clear and accurate comments while also using Copilot to create efficient SQL code.

Screenshot of Fabric Data Warehouse Query Editor with Copilot Comment Suggestion.

Copilot can provide different suggestions for the same input. You can hover over the suggestion to preview the other options.