How to: Use Copilot quick actions for Synapse Data Warehouse
Applies to: ✅ Warehouse in Microsoft Fabric
There are two AI-powered quick actions that are currently supported in Copilot for Data Warehouse: Explain and Fix.
Quick actions can accelerate productivity by helping you write and understand queries faster. These buttons are located at the top of the SQL query editor, near the Run button.
The Explain quick action will leave a summary at the top of the query and in-line code comments throughout the query to describe what the query is doing.
The Fix quick action will fix errors in your query syntax or logic. After running a SQL query and being met with an error, you can fix your queries easily. Copilot will automatically take the SQL error message into context when fixing your query. Copilot will also leave a comment indicating where and how it has edited the T-SQL code.
Copilot leverages information about your warehouse schema, query tab contents, and execution results to give you relevant and useful feedback on your query.
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.
Get started
Whether you are a beginner or an expert in writing SQL queries, quick actions allow you to understand and navigate the complexities of the SQL language to easily solve issues independently.
Explain
To use Copilot to explain your queries, follow these steps:
Highlight the query that you want Copilot to explain. You can select the whole query or just a part of it.
Select the Explain button in the toolbar. Copilot will analyze your query and generate inline comments that explain what your code does. If applicable, Copilot will leave a summary at the top of the query as well. The comments will appear next to the relevant lines of code in your query editor.
Review the comments that Copilot generated. You can edit or delete them if you want. You can also undo the changes if you don't like them, or make further edits.
Fix
To get Copilot's help with fixing an error in your query, follow these steps:
Write and run your query as usual. If there are any errors, you will see them in the output pane.
Highlight the query that you want to fix. You can select the whole query or just a part of it.
Select the Fix button in the toolbar. This button will only be enabled after you have run your T-SQL query and it has returned an error.
Copilot will analyze your query and try to find the best way to fix it. It will also add comments to explain what it fixed and why.
Review the changes that Copilot made and select Run to execute the fixed query. You can also undo the changes if you don't like them, or make further edits.