How to: Use Copilot code completion for Synapse Data Warehouse
Applies to: ✅ Warehouse in Microsoft Fabric
Copilot for Data Warehouse provides intelligent autocomplete-style T-SQL code suggestions to simplify your coding experience.
As you start writing T-SQL code or comments in the editor, Copilot for Data Warehouse leverages your warehouse 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. It 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 F64 or P1 capacity needs to be in one of the regions listed in this article, 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 (F64 or higher, or P1 or higher) are supported.
- For more information, see Overview of Copilot in Fabric and Power BI.
How can code completions help you?
Code completion enhances your productivity and workflow in Copilot for Data Warehouse 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 to or experienced with SQL, code completion helps you save time and energy with writing SQL code, and focus on designing, optimizing, and testing your warehouse.
Key capabilities
- Auto-complete partially written queries: Copilot can provide context-aware SQL code suggestions or completions for your partially written T-SQL query.
- Generate suggestions from comments: You can guide Copilot using comments that describe your code logic and purpose, using natural language. Leave the comment (using
--
) at the beginning of the query and Copilot will generate the corresponding query.
Get started
Verify the Show Copilot completions setting in enabled in your warehouse settings.
Start writing your query in the SQL query editor within the warehouse. As you type, Copilot will provide 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 do not 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 warehouse object, condition, or methods to use. Copilot can even autocomplete your comment to help you write clear and accurate comments more efficiently.