Are you a PostgreSQL enthusiast using DBeaver on a Windows Platform? If you find yourself knee-deep in SQL queries and long for a cleaner, more organized code, then configuring pgFormatter might be the solution you’re looking for. In this post, we’ll dive into the intricacies of setting up pgFormatter within DBeaver on Windows, offering you a streamlined and visually appealing SQL coding experience.
Whether you are a database administrator, developer, or a curious SQL fan, understanding how to integrate pgFormatter into your /DBeaver workflow can significantly enhance your coding efficiency. Let’s embark on this step-by-step journey to configure pgFormatter, making your SQL code more readable and consistent. Let us get started!
It is an open-source tool used to format SQL and PLPGSQL code, it is widely embraced by the PostgreSQL community. You can find comprehensive details about it on the official PostgreSQL site.
Note: In case you are using Mac or Linux, you can find many resources explaining how to configure SQL Formatter in DBeaver. A useful link is here.
Contents
Before diving into the use of SQL Formatter tool, you need to ensure the following components are in place:
First of all, it is mandatory before using SQL Formatter to configure Perl, which is the language used internally by SQL Formatter. Later, we should download SQL Formatter, copy it to a specific directory and finally do the proper configuration on DBeaver. The following sections will explain to you in detail how to do it.
For Windows users, the critical first step is to install Perl, the language used internally by SQLFormatter. I recommend using Strawberry Perl, a simple and reliable package available at this link.
My recommendation is to install the System installer version, mainly because the .msi file automatically registers in the PATH. After installation, open the command line and verify the Perl version by running ‘perl -v
‘
The pgFormatter package is available in the next links:
Once you have downloaded the zip file, you should extract it into a target folder, as in this example:
At this point, we can go DBeaver and configure the use of pgFormatter as an external formatted. Go to the Windows –> Preferences –> Editors –> Formatting. Once in there, you should follow the instructions on this code:
perl.exe "Path_of_pg_format_package\pg_format" ${file}
It is mandatory to mark Use temp file for managing the format on the current code (highlighted). See this example:
At this point, we are ready to start with pgFormatter inside DBeaver. The following image shows you a code without format:
You should select the code and apply the key shortcut combination: Ctrl + Shift + F. Here is the output:
In conclusion, this post provides a straightforward approach to enhancing the appearance of your SQL code using pgFormatter in DBeaver. The ability to customize preferences and further adapt with pgFormatter is a topic we’ll explore in future posts. Happy Coding!
This article offers a comprehensive, step-by-step guide for integrating Azure Blob Storage with a Snowflake…
In this quick guide, we’ll walk through the essential steps to connect to Snowflake using…
I am thrilled to share that I have embarked on a new professional journey as…
Since 2005, I've immersed myself in the dynamic world of data and its modeling. It's…
Over time, it's fascinating to witness how certain concepts, approaches, or visions age. Time, in…
When we are working with lists, dictionaries, and sets in Python, we have a special…