Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

ashishrj

Configuring Power BI Connectivity to PostgreSQL Database

Prerequisites:

Power BI Desktop, PostgreSQL Database, pgAdmin III, Visual Studio 2008 or higher

 

Introduction

 

Power BI supports connectivity to different databases such as SQL Server, MySQL, Oracle and many more (list of all supported databases given here ). By providing necessary details such as server name, database name, username & password, you can easily connect to database and start exploring data using different visualizations in the form of reports/dashboards.

 

This article will walk you through the necessary steps required to configure in your system before establishing connection of Power BI Desktop Tool to PostgreSQL Database.

After installation of PostgreSQL database in your machine, if you try connecting Power BI Desktop Tool to PostgreSQL Database, you will get following error as shown in the screenshot below:

 

 1.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Following are the steps required to connect Power BI Desktop Tool to PostgreSQL Database:

 

  1. Setup PostgreSQL Client
  2. Connect Power BI Desktop Tool to PostgreSQL

Below are the steps that will walk you through setting up PostgreSQL Client:

 

Step 1: Download the latest MSI from this page and install it in your machine.

 

Step 2: Once this is done, you can now try connecting Power BI to PostgreSQL. However you will notice below error

 

2.png 

 

Once you restart your machine, you can now connect to PostgreSQL and start playing with your data. Below are the steps for connecting Power BI Desktop Tool to PostgreSQL:

 

Step 1: Open pgAdmin III interface to create database, table and few records to display in your report as shown in screen capture below

 

 6.png

 

Step 2: Open Power BI Desktop Tool and click ‘Get Data’ and select PostgreSQL Database as shown below

 

Step 3: Enter server name (in our case it is localhost), database name, username and password as shown in below screen capture

 

 

 4.png

 

Step 4: Select required table from database and click load as shown in screen capture below

 

5.png 

 

Step 5: Once data is loaded in model, you can start playing around with the data and create beautiful visualizations/reports as shown in image below and later publish it to Power BI Online Service

Comments


Hi ashishrj,

 

Quick question. I got the connection up and running and I am able to bring data from PostgresSQL to PBI Desktop. However, every time I refresh the data manually, I need to call the refresh twice. First time it will fail, then it will succeed in the second attempt.

In the gateway, it consistently fails (I am not sure whether it does retries or not).

 

Any thoughts?

 

Hi @GALROY, this is something unusual. You can send a frown as shown below or you can post this issue/bug on Power BI community (under post your questions) section so that it can be notified by Power BI Team. 

 

SendFrown.png

 

Thank you for your post. but it doesn't helped me. Is there any other idea? Could you please provide us with the ininformation ?

Great post @ashishrj.

If using npgsql v3.x.x there no longer any need for monosecurity.dll.

https://github.com/npgsql/npgsql/releases

 

Also, if you select the option to install to the GAC during install, you will not need to copy the dll into windows assembly.

 

This may help others as it took me a while to find the answer.

Thanks

Jason

Hi, why is VS 2008 or later needed? If I don't have it, am I out of luck for using postgres w/ power bi? That doesn't make sense.

HI, I just noticed jason_rmh's post from January 2016. So it appears that none of these steps are required for the newer version of npgsql.

Hello,
We follow all the steps suggested, but can not connect to our PostgreSQL base.
We have a hosted basis of AWS.

Thanks

Guys,

 

I second the previous message. Postgresql connection doesn't work with AWS and it is a huge limitation. I know you guys are trying to push for Azure, but AWS is currently the market leader and most startup companies use the PostgreSQL databases from AWS. When is the fix coming ?

 

Also, as a sidenote: I create an account for Power BI. Why do I need to create a different login password to write here ? That is pretty annoying.

 

Hope I your Postgresql fix is coming soon !

 

Thanks

Hello, 

 

I have been able to import a table from a PostgreSQL database and I have a created several graphs in Power BI. 
Nevertheless, I have a new table now in the database with a different name (but the same table structure).

Can I replace the old table for the new table to load the data easily into the template? And just refresh the graphs?

 

Thank you in advance for your help.

 

Kind regards, 

Andrea

Any way to do Native Query with SELECT WHERE statements?

Let's see that again but this time put PostgreSQL on a remote server running SSL encryption (using LetsEncrypt).

hi,  ashishrj, I have installed Npgsql-3.2.4.msi, and restart computer, but the issue is still. How should I do?

 

 PostgreSQL.png

 

 

pentaho.PNG

Hi, I follow all the steps above but still failed to connect with postgreSQL due to access path is denied. Really need help on this. Anyone? Thank you in advance.

This is very informative blog thanks fro posting

Consegui instalar o MSI (NPGSQL) e avancei para etapa de conexão. No entanto aparece o seguinte erro de regeição.
Erro de servidor.png

Eu consigo conectar a esse banco usando PgAdmin 3.

O que devo fazer?