DEV Community

Mary Ngure
Mary Ngure

Posted on

How I connected PowerBI to PostgreSQL locally and on Aiven

Data rarely lives inside Excel forever. As datasets grow, they're typically stored in databases where they can be managed efficiently and accessed by multiple applications. That's why learning to connect Power BI directly to SQL databases is an essential skill for every data analyst.

This week, I explored two different ways of connecting Power BI to PostgreSQL databases:

  • A local PostgreSQL database
  • A cloud-hosted PostgreSQL database using Aiven with SSL encryption

For this exercise, I used PostgreSQL, DBeaver for database management, Aiven for cloud database hosting, and Power BI Desktop for data visualization.

Although both connections ultimately bring data into Power BI, the setup process is quite different. Here's what I learned.


Why Connect Power BI to a Database?

Instead of importing CSV files every time new data becomes available, Power BI can retrieve data directly from a database. This makes reporting more scalable, reliable, and suitable for production environments.

Some benefits include:

  • Centralized data storage
  • Improved security
  • Easier collaboration
  • Faster report updates
  • Support for larger datasets

Part 1: Connecting Power BI to a Local PostgreSQL Database

Before working with a cloud-hosted database, I first set up a local PostgreSQL environment. Using DBeaver, I connected to my local PostgreSQL instance and imported the JCars Logistics dataset. DBeaver provided a convenient interface for managing the database and verifying that the data had been imported successfully.

With the dataset in place, I connected Power BI to the local PostgreSQL database by entering the server details and authentication credentials. Once the connection was established, Power BI loaded the tables, making them available for analysis and reporting.

This local setup served as a useful foundation before connecting to a cloud-hosted PostgreSQL database on Aiven, where additional security measures such as SSL certificate configuration were required.
Using Dbeaver, I connected Postgresql and uploaded my data.

Part 2: Connecting Power BI to an Aiven PostgreSQL Database

Unlike a local database, Aiven hosts PostgreSQL in the cloud. This means the connection requires additional security through SSL certificates.

Step 1: Import the Dataset into Aiven Using DBeaver

Instead of importing the dataset directly through the Aiven web interface, I used DBeaver as my database management tool. After connecting DBeaver to my Aiven PostgreSQL instance using the connection details provided by Aiven, I imported the JCars Logistics dataset into the target database.

Using DBeaver made it easier to manage the database, verify that the import was successful, and inspect the tables before connecting them to Power BI.

DBeaver connected to the Aiven PostgreSQL database and JCars Logistics tables successfully imported and visible in DBeaver.


Step 2: Obtain the SSL Certificate

Because Aiven encrypts database connections, Power BI requires the CA SSL certificate before it can establish a secure connection.

I downloaded the CA certificate from the Aiven service dashboard and saved it locally for use during the connection process.

SSL certificate download page in Aiven.

Confirmed that the SSL was downloaded and in my certificates management.

Step 3: Connect Power BI to Aiven

Inside Power BI, I again selected PostgreSQL Database, but this time entered the cloud connection details provided by Aiven, including the hostname, port, database name, username, and password.

I then configured the SSL certificate, allowing Power BI to establish a secure encrypted connection to the cloud database.

PostgreSQL connection with PowerBI.


Step 4: Load the Tables

Once the connection was authenticated, Power BI displayed all available tables from my Aiven database. I selected the required tables and loaded them into the report for analysis.

Navigator showing tables from the Aiven PostgreSQL database.


What I learned

Connecting Power BI to a local database is mostly about getting the server
name and credentials right. Connecting to a cloud database adds two extra
considerations: the non-standard host/port from your provider's dashboard,
and SSL, which cloud providers enforce by default for security. Once you've
done it once, the pattern is the same for any provider; Aiven, AWS RDS,
Azure Database, or Google Cloud SQL all follow this same shape: get
connection details from the console, ensure SSL is respected, connect via
Power BI's native connector, and choose Import mode so your report doesn't
depend on the database staying reachable.


Key Takeaways

This exercise showed how Power BI can connect seamlessly to both local and cloud-hosted PostgreSQL databases. While local databases are simpler to configure, cloud platforms like Aiven introduce additional security measures such as SSL certificates that are common in production environments.

Using DBeaver alongside Aiven also simplified database management by making it easy to import the dataset, inspect tables, and verify that everything was ready before connecting to Power BI.

As organizations continue moving their data infrastructure to the cloud, understanding how to connect business intelligence tools like Power BI to secure cloud databases is becoming an essential skill for every data professional.

Top comments (0)