If you’re a developer who wants to learn MySQL or improve your productivity while developing with MySQL, then GitHub Copilot on Azure Data Studio can help get you started.
GitHub Copilot is an AI-powered code completion tool developed by GitHub and powered by OpenAI. It leverages machine learning models trained on vast amounts of code to generate context-aware code suggestions directly within your integrated development environment (IDE). You can use GitHub Copilot as an extension in Azure Data Studio and Visual Studio Code.
In this blog post, I’ll demonstrate how GitHub Copilot can act as an AI pair programmer by providing intelligent suggestions and more while coding with MySQL.
Before getting started, I'll set up the environment on a local machine as follows:
In this blog post, I'll be using Azure Database for MySQL - Flexible Server as an example to work with GitHub Copilot.
Get the connection details for an instance of a MySQL database server, and then add the connection to Azure Data Studio by performing the following steps.
You can view your databases and table, and then create a new query to start using GitHub Copilot in Azure Data Studio.
Next, I want test out a few scenarios for using prompts to create new queries to run against the MySQL table.
In the query editor, use the statement -- get all rows from customers table to show the results of a SELECT statement for the customers table.
To accept the suggestion, press TAB, and then run your statement.
Copilot is context-aware, so there's no need to be too specific in prompts. For example, let's ask to create an index on the customers table. Use the statement -- create an index on this table primary key to allow it to reference the previous statement and create an index.
When building the schema, start with a base template for the table by using the statement -- create new table for person details, which will generate the following output:
You can use this as a starting point and add more fields as needed.
Copilot will provide suggestions to complete a query, which allows for building queries more quickly.
You can also use natural language to help Copilot create the following query:
Copilot takes advantage of natural language instruction, as in the examples above, to create more complex queries, say to pivot the results of a query. Copilot can sometimes provide multiple suggestions to choose from, and you can choose whichever suggestion is most useful to you.
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. Form information about GitHub Copilot, see the documentation for Azure Data Studio, MySQL extension, and GitHub Copilot.
If you have any feedback or questions about the information provided above, please leave a comment below or email us at AskAzureDBforMySQL@service.microsoft.com. Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.