Introducing GitHub Copilot for Azure Data Studio

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Community Hub.

GitHub Copilot, an AI-powered pair programmer, is now available for Azure Data Studio to assist you with context-aware code completions, suggestions, and even entire code snippets. Get started today with the latest release of Azure Data Studio, version 1.44, by installing the extension for GitHub Copilot from the extension gallery. 

ads-copilot.png

How Copilot works

While the GitHub Copilot in Azure Data Studio documentation has details on how to fully navigate different code suggestion options, interacting with your newest assistant couldn’t be easier. After installing the GitHub Copilot extension and signing in with your GitHub account, when you type in the SQL editor Copilot will automatically provide autocompletion suggestions.  These suggestions may be for a code block or an entire script.

IntelliSense is the familiar prompt for basic syntax and object names from the connected database, providing additional reference information as you write SQL one word at a time. By contrast, Copilot provides larger code suggestions but does so from the context in the editor and common code syntax. Copilot and IntelliSense are not an “either or” question, they work side-by-side to increase your development speed. 

 

Example uses

When writing out a commonly structured SQL query, Copilot immediately goes to work by suggesting a join condition and where clause. 

 common-syntax.png

 

The suggestions GitHub Copilot provides are not only inspired by the code I’ve already written, but I can provide direction with comments. In the next example, I roughly describe a table and GitHub Copilot converts this out to T-SQL. 

table-definition.png 

In the next two examples we see how GitHub Copilot can take comments in natural language, as if I were talking to my computer, and create code suggestions. I’ve written a query and when I ask for an index based on the query, Copilot creates an index recommendation based on its understanding of the query and common code patterns. In the example of index creation, we know that it takes a detailed understanding of a workload to determine which indexes are appropriate and use Copilot as a coding assistant. 

index-completion.png 

The concept of providing natural language instruction to Copilot extends to creating more complex queries, such as in the case where I want to pivot the results of a query. Code syntax for extended constructs such as PIVOT can be difficult to remember, so it’s great to have GitHub Copilot knocking it out in two suggestions. 

code-suggestion-from-comment.png

 

code-suggestion-from-comment-2.png

 

Get started with Copilot

You can get started today with GitHub Copilot in Azure Data Studio by installing the latest Azure Data Studio release and installing GitHub Copilot from the extension marketplace. More information on GitHub Copilot is available in the documentation for Azure Data Studio and GitHub Copilot. 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.