When you are working with a database, or any other kind of software, your experience is enhanced or hindered by the tools you use to interact with it. PostgreSQL has a command line tool, psql, and it’s pretty powerful, but some people much prefer a graphical editor. Even if you typically use command line, you may want to go visual sometimes. At Microsoft we've spent many years building experiences to enhance developers' day-to-day productivity. Having choices is important. It allows you to go with the tool that works for you.
Today we're excited to announce preview support for PostgreSQL in Azure Data Studio. Azure Data Studio is a cross-platform modern editor focused on data development. It's available for Linux, MacOS, and Windows. Plus, Azure Data Studio comes with an integrated terminal so you're never far away from psql.
We're also introducing a corresponding preview PostgreSQL extension in Visual Studio Code (VS Code). Both Azure Data Studio and VS Code are open source and extensible – two things that PostgreSQL itself is based on.
Azure Data Studio inherits a lot of VS Code functionality. It also supports most of VS Code's extensions like Python, R, and Kubernetes support. If your primary use case is data, choose Azure Data Studio. You can manage multiple database connections, explore database object hierarchy, set up dashboards, and more.
On the other hand, if you're closer to application development than you are to database administration, then go for our PostgreSQL extension in VS Code. Actually, you don't have to choose – use both, switching according to what works best for you at the time.
Connect to Postgres
Curious about what’s included? Let’s take a deeper look at the development experience for PostgreSQL in Azure Data Studio. You can connect to your Postgres server or establish a connection directly to a database. The Postgres server can be hosted on-premises, in a virtual machine (VM), or from the managed service of any cloud provider.
Organize your servers
Often you have multiple Postgres servers you’re working with. Perhaps there’s one production server, a corresponding stage server, and maybe multiple dev/test servers. Knowing which is which is key, especially being able to clearly identify your production server. In Azure Data Studio you can use server groups to categorize your servers. You can highlight your production server group in red to make it visually distinct from the others.
Track down database objects
Your Postgres server evolves as you add new functionality. It’s helpful to be able to clearly see what columns, indexes, triggers, and functions have been created for each database and table. This is especially true when you’re not the only person working on that Postgres instance. Azure Data Studio provides convenient hierarchical navigation in the sidebar. With it you can easily explore and keep track of your server's databases, tables, views, and other objects.
Write queries efficiently
As you look through the new database objects your teammates have created, it’s helpful to go beyond the name of the object to the DDL that composes it. Even if you’re the only person working on your Postgres instance, there may be objects you created a while back that you want to look up. Checking the DDL is a useful double-check to confirm that an object is doing what you expect.
Azure Data Studio provides “Peek Definition” and “Go to Definition” functionality so you can do that, and even do it as you use the object in a query. For example, let’s say you want to query pg_stat_activity, one of the built-in statistics views that comes with Postgres. You can use “Go to Definition” to see all its columns and understand what this view is based on.
Writing SQL queries is bread and butter when working with Postgres, whether you’re an expert or are just getting started with this RDBMS. Whoever you are, IntelliSense for SQL is integrated into Azure Data Studio to help you write your queries quicker. With IntelliSense’s context-aware code completion suggestions, you can use fewer keystrokes to get the job done.
If you use Postgres a lot, you probably have a few SQL queries you end up reusing over and over. Whether they are detailed CREATE statements or complex SELECTs, you can templatize each one into a SQL code snippet. That way you don’t have to retype it afresh each time. Azure Data Studio inherits its code snippet functionality from Visual Studio Code. Code snippets help you avoid errors from retyping code, and overall let you develop faster.
Customize your editor
One advantage of modern development GUIs is the ability to customize them to suit your unique preferences. For example, in this blog we’ve used the Solarized Dark theme in screenshots. Honestly, that isn’t everyone’s cup of tea. Well there are ten more color themes you can choose from in Azure Data Studio, not to mention a high contrast option.
The personalization options extend to key bindings as well. Don't like using the default Ctrl+N to open a new tab? You can change it. Or maybe you want a keyboard shortcut that doesn't come out of the box with Azure Data Studio. You can create and customize key bindings using the Keyboard Shortcuts editor.
How to get started
There are even more features to discover, like Git source control integration and customized dashboards and widgets. You can start using the preview for PostgreSQL in Azure Data Studio today – check out the install instructions. To start using our preview PostgreSQL extension for Visual Studio Code, learn more on our GitHub page.
These two features are in preview and your feedback is critical to making them better and making them work for you. Share your feedback on our PostgreSQL GitHub pages for Azure Data Studio or Visual Studio Code respectively.
Quelle: Azure
Published by