Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: ✅ SQL database in Microsoft Fabric
Copilot in Fabric in the SQL database workload includes a code completion feature with Copilot.
As you start writing T-SQL code or comments in the editor, Copilot in Fabric SQL database uses your database schema and query tab context to complement the existing IntelliSense with inline code suggestions.
- The completions can come in varied lengths - sometimes the completion of the current line, and sometimes a whole new block of code.
- The code completions support all types of T-SQL queries: data definition language (DDL), data query language (DQL), and data manipulation language (DML).
- You can accept all or part of a suggestion or keep typing to ignore the suggestions. Copilot can also generate alternative suggestions for you to pick.
Prerequisites
- Your administrator needs to enable the tenant switch before you start using Copilot. For more information, see Copilot tenant settings.
- Your F2 or P1 capacity needs to be in one of the regions listed in Fabric region availability.
- If your tenant or capacity is outside the US or France, Copilot is disabled by default unless your Fabric tenant admin enables the Data sent to Azure OpenAI can be processed outside your tenant's geographic region, compliance boundary, or national cloud instance tenant setting in the Fabric Admin portal.
- Copilot in Microsoft Fabric isn't supported on trial SKUs. Only paid SKUs (F2 or higher, or P1 or higher) are supported at this time.
- For more information, see Overview of Copilot in Fabric and Power BI.
Verify the Show Copilot completions setting in enabled in your database settings.
- You can also check the setting's status through the status bar at the bottom of the query editor.
How can code completions help you?
Code completion enhances your productivity and workflow in Copilot in Fabric SQL database by reducing the cognitive load of writing T-SQL code. It accelerates code writing, prevents syntax errors and typos, and improves code quality. It provides helpful, context-rich suggestions directly within the query editor. Whether you're new or experienced with T-SQL, code completion helps you save time and energy with writing code, and focus on designing, optimizing, and testing your database.
Key capabilities
- Auto-complete partially written queries: Copilot can provide context-aware SQL code suggestions or completions for your partially written SQL query.
- Generate suggestions from comments: Guide Copilot using comments that describe your code logic and purpose using natural language. Leave the comment at the beginning of the query and Copilot generates the corresponding query.
Get started
To begin using the Copilot Code Completion feature, follow these steps to enable and utilize its capabilities effectively in the SQL query editor.
Start writing your query in the SQL query editor within the database. As you type, Copilot provides real-time code suggestions and completions of your query by presenting a dimmed ghost text.
You can then accept the suggestion with the Tab key, or dismiss it. If you don't want to accept an entire suggestion from Copilot, you can use the Ctrl+Right keyboard shortcut to accept the next word of a suggestion.
Copilot can provide different suggestions for the same input. You can hover over the suggestion to preview the other options.
To help Copilot, understand the query you're writing, you can provide context about what code you expect by leaving a comment with
--
. For example, you could specify which database object, condition, or methods to use. Copilot can even autocomplete your comment to help you write clear and accurate comments more efficiently.