This article will mention five helpful Azure Data Studio extensions that may help to improve the SQL developers’ productivity.
Introduction
SQL developers make an effort on query coding more than database administrators. One of the main responsibilities of SQL developers is to write complex queries and they also deal to create and alter the stored procedures, views, and triggers. In this context, the development environment usability and ease of adaption to new features gain more importance for SQL developers. We started using SQL Server Management Studio (SSMS) with SQL Server 2005 and we are still using it with great enjoyment. However, Azure Data Studio entered the game about two years ago and became a second database development platform option for SQL developers.
Azure Data Studio (ADS) is a new generation database administration, development, and maintenance platform that can be used for on-premises and cloud data platforms. One of the appealing features of Azure Data Studio is that it gains various new functionalities by adding extensions to it. In the next sections of this article, we will shortly look at the following extensions that can supply comfort in our database development works:
- Atom One Dark Theme
- SQL Server Profiler
- WakaTime
- Query History
- Visual Studio IntelliCode
Atom One Dark Theme extension
Azure Data Studio includes a dark theme in its default installation. We can enable the default dark theme by the way of the different methods:
- Expand the File menu and then choose the Color Theme option under the Preferences menu item.
- Click the Manage button and then choose the Color Theme option.
- Open the command palette (Ctrl+Shift+P) and find the Color Theme option.
After clicking Color Theme, the theme options will be listed and we can set the Azure Data Studio theme which we like.
Atom One Dark Theme is an alternative option to the default themes. Firstly, we find the Atom One Dark Theme extension from the marketplace and click the Install button where is located in the lower right corner.
We select the vsix file of the extension and download it from the Github repository.
Tip: A vsix file is an installable form of the Visual Studio extensions that are used to install the extensions into the Visual Studio and Visual Studio Code. We can explore and download the extensions in the Visual Studio marketplace.
In order to install the atom one dark theme, we press the Ctrl+Shift+P key combination to open the command palette and find and then click the Install from VSIX… command.
Tip: We can launch the command palette to use the View menu of the Azure Data Studio.
At last, we will choose the downloaded VSIX file path and then enable the theme. After that, the Atom One theme will be added to the theme list.
The appearance of our code will be like as below with the Atom theme.
SQL Server Profiler extension
The SQL Server extension is a query tracking and activity monitoring tool that is developed for Azure Data Studio. However, unlike the profiler word in its name, it uses XEvents. After installing the SQL Server profiler extension from the marketplace, we can create a new trace through the command palette.
Profiler extension offers Standard_OnPrem and TSQL_OnPrem templates as default on-premises installations.
Standard_OnPrem captures the following events:
- Attention
- existing_connection
- login
- logout
- rpc_completed
- sql_batch_completed
- sql_batch_starting
TSQL_OnPrem captures the following events:
- existing_connection
- login
- logout
- rpc_starting
- sql_batch_starting
After starting a trace the captured data will be displayed event viewer window. In this window, we can filter the captured event data.
The Select View option enables to change of the appearance of the profiler.
When we click the Details tab, we can see the clicked row event details.
WakaTime
WakaTime is a productivity tracking tool that analyzes and monitors how much time a developer spent time with coding. The Wakatime supports numerous IDE and we can also install it into the Azure Data Studio.
At first, we will download and install the Wakatime extension from the marketplace, and then we need the restart the Azure Data Studio. As the next step, we enter an API Key to integrate ADS and Wakatime to enable the tracking of our coding activity. We can find the API Key under the Setting page of the Wakatime portal.
Tip: If you don’t have a Wakatime account, you can easily generate it with your GitHub account or can create an individual account.
We find WakaTime: Api Key settings in the command palette and enter the API Key.
After spending some time with coding, our activities will be tracked by Wakatime and we can monitor these activities with a dashboard. We find the Wakatime: Open Dashboard command and click it.
Poor SQL Formatter
There are various best practices for writing readable code. For example, the following best practices may help to improve our queries code readability:
- Adding clear and short explanations into the queries
- As possible as to apply the DRY (Don’t Repeat Your Self) principle
- Use meaningful and long enough variable names
Along with all these best practices, a well-organized and nice look definitely helps with code readability. Poor SQL Formater is a T-SQL query beautifier tool that helps to re-form more readable and pleasant to look at. We re-format the T-SQL queries to execute the Poor SQL: Format T-SQL command in the command palette.
For example, the code above will be formatted as follows with Poor SQL formatter.
We can assign a shortcut key combination to make this query formatting easier to run. On the command palette, we find the Poor SQL: Format T-SQL and then click the Configure Keybinding button where is located on the right side of the command palette.
In the configuration window, we double-click on the Keybinding column and then we press the key combination which we want to assign as a shortcut for the Poor SQL formatter.
Query History
Query History extension captures and stores the past executed queries and then enables to show them through a panel. After installing the query history, we can enable the query history panel to use the View menu of the Azure Data Studio.
When we execute any query, the Query Store begins to store the executed queries and display the previously executed queries in a panel.
In this panel, we can find the different information about the executed query :
Status icon: This icon shows the status of the last executed query. The green check sign shows the query is completed successfully. The red cross symbol specifies the executed query encountered an error during its execution.
Query Text: This column shows the text of the executed query and also when we right-click on this tab open, run and delete the selected query in a separate window.
The Clear All History menu item clears all historical query and the Pause Query History Capture stops capturing the executed queries temporarily.
Visual Studio IntelliCode
Visual Studio IntelliCode is a code completion tool that is assisted with machine learning (ML) algorithms to predict code completions. The main benefit of this IntelliCode improving the productivity of the developer. The code completion recommendations are developed based on open-source projects on GitHub so that the code completion predictions are closer to coding practices rather than alphabetical or most-recently-used lists.IntelliCode supports the following programming languages:
C#, C++, Visual Basics, XAML, JavaScript, TypeScript, Java, Python, SQL.
After installing the Visual Studio IntelliCode extension of the Azure Data Studio the IntelliCode code completion recommendations will be enabled. For example, the default code recommendation of the ADS offers a WHEN syntax after the table name of the select statement.
However, IntelliCode offers a WHERE clause and it is more reasonable because we almost always use a WHERE or JOIN clause after a table name.
Summary
In this article, we explored some beneficial Azure Data Studio extensions that help to improve the productivity of the query coding process.
- SQL Performance Tuning tips for newbies - April 15, 2024
- SQL Unit Testing reference guide for beginners - August 11, 2023
- SQL Cheat Sheet for Newbies - February 21, 2023