Connecting Azure Data Studio to Postgres

Connecting Azure Data Studio to Postgres

  • data
  • 2024-05-09
  • 2 minutes to read
Table of Contents

Introduction

I have been working with a Postgres database in a docker container recently to get to grips with dbt. I typically work in the world of SQL Server and so I have Azure Data Studio installed on my Mac. I was delighted to discover that Azure Data Studio is capable of connecting to a Postgres database. Here’s how to do it…

Install Azure Data Studio

Firstly, you need to install Azure Data Studio. You can download it from here .

Install the Postgres extension

Once you have installed Azure Data Studio, you need to install the Postgres extension. You can do this by clicking on the Extensions icon on the left-hand side of the screen and searching for Postgres or by clicking here .

Create a new connection

Once you have installed the extension, you can create a new connection by clicking on the New Connection icon on the left-hand side of the screen. You will need to enter the following details:

  • switch Connection type to PostgreSQL.
  • enter the Server name - if you set up the Postgres container on a non-default port, you can enter the port number here separated by a comma.
  • enter the user name and password.
  • enter the database name.

Connect to the database

Once you have entered the details, you can click on the Connect button. If you have entered the details correctly, you should see the database in the Object Explorer on the left-hand side of the screen. You can also create databases, tables, and run queries from here.

Unresponsive

The extension is still in preview and so it is a bit buggy. I have found that sometimes I need to close and reopen Azure Data Studio to get it to connect to the database as it will just hang whilst refreshing the connection in the object explorer. I’m sure there are better tools out there for connecting to Postgres databases, but as a way to just get started quickly to evaluate dbt with the tools that I’m already comfortable with, it’s ideal.

Conclusion

I have shown you how to connect Azure Data Studio to a Postgres database. vscode / Azure Data Studio are such flexibile tools it’s great to be able to work with a multitude of different languages, databases, and extensions all in once place.

References

#mtfbwy



Recent Posts

Hugo Live Reload Keeps Reloading

Hugo Live Reload Keeps Reloading

  • 2024-05-18
  • 3 minutes to read

I have run into an issue from time to time where Hugo's live reload feature keeps reloading the page. This is how I fixed it.

Read More
First Steps with Mermaid in Vscode

First Steps with Mermaid in Vscode

  • 2024-05-17
  • 7 minutes to read

My blog theme supports mermaid, a visual diagram syntax, so I wanted to try it out in vscode.

Read More
T-SQL Tuesday #174 My favourite job interview question

T-SQL Tuesday #174 My favourite job interview question

  • 2024-05-14
  • 4 minutes to read

This is my 12th contribution to TSQL Tuesday, the data community blog party. Have a read, and why not join in next time!

Read More