Blog Post

Azure SQL Blog
2 MIN READ

Introducing GitHub Copilot for Azure Data Studio

DrewSkwiersKoballa's avatar
May 24, 2023

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. 

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. 

 

 

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. 

 

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. 

 

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. 

 

 

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. 

Updated May 24, 2023
Version 1.0

4 Comments

  • Mxxxx's avatar
    Mxxxx
    Copper Contributor

    Even with simplest basic prompts, Copilot does not generate any SQL query for MySQL database.   Is this feature even working for anyone else?

  • vicopochoBBG's avatar
    vicopochoBBG
    Copper Contributor

    I totally agree with MauricioCadena . Any idea when you are integrating Copilot on this way? I may just be weary about data security and privacy. 

  • larry-ta's avatar
    larry-ta
    Copper Contributor

    When do you think we might expect a CoPilot like Mauricio describes? One that can ingest the schema of the database being queried, understand its foreign key relationships, maybe even plumb the stored procedures and UDFs within the database for more context and index them in an Azure Data Studio extension running a small vector database and use them in a Retrieval-Augmented Generative (RAG) fashion?

     

    We operate a multi-tenant system where the schema has grown to over 400 tables and 4500 total columns. We've meticulously documented it all, storing metadata in MS_Description fields. It's all there for the ingesting, by an appropriately motivated chatbot.

     

    I would absolutely love to be able to give our data users access to that kind of chatbot.

  • Next level would be to get suggestions based on current connection based on metadata from database objects…..