3

I want get data into Power BI desktop from PostgreSQL (on my local machine). I tried the solution given here (Installing ngpsql to use PostgreSQL in PowerBI), but it did not work.

Basically, I installed the latest version of ngpsql(3.2.4) with the option to install to GAC. However, I'm getting the same error in Power BI saying that the connector requires one or more additional components.

Am I missing any steps? I looked online but did not find any recent documentation on this.

Any help is very much appreciated.

Thanks

let_there_be_light
  • 837
  • 3
  • 9
  • 15
  • Can you please try installing 3.2.4.1 and not 3.2.4? There was a versioning issue with 3.2.4 – Shay Rojansky Jul 13 '17 at 05:36
  • 2
    I tried npgsql 3.2.5 and it worked. My steps as below: 1. Install npgsql as Administrator (since the DLL would be pushed to GAC); 2. During the installation stage, enabled "Npgsql GAC Installation"; 3. Restart the PC, then launch PowerBI. The connection should work. – Lavande Oct 12 '17 at 07:50
  • Nov 2019 - A simple way to install is here - https://stackoverflow.com/a/59080365/984471 – Manohar Reddy Poreddy Feb 19 '20 at 00:55

2 Answers2

6

Three ways :

1 - The ngpsql way does work if your follow the comment of Lavande:

  1. Install npgsql as Administrator (since the DLL would be pushed to GAC);
  2. During the installation stage, enabled "Npgsql GAC Installation";
  3. Restart the PC

2 - With ODBC, i used this walk-through

  • install ODBC connector here
  • start it and create a new connection (DSN)
  • in Power BI, get data, ODBC,PostGreSQL, no options
  • enter the credentials.
  • select the table(s) of interest.

3 - With the M query language.

Nota : the Power BI community posts ? well, ...

Jordan
  • 3,813
  • 4
  • 24
  • 33
-1

Another option to solve this problem is to create a Python script to connect to Postgresql.

Using a script like this:

import psycopg2
import pandas as pd

con = psycopg2.connect(host='localhost', database='Your DataBase',
user='user', password='password')
cur = con.cursor()


cur.execute('Your Query')
data = cur.fetchall()

df = pd.DataFrame(data, columns=['Your Columns'])
Rafael
  • 11
  • how is this answer relevant to Question asked by OP? he is asking solution to connect PostgreSQL to PowerBI. – loving_guy Jun 22 '21 at 11:08
  • This solution uses python to connect PostgreSQL to PowerBI. It's relevant and it was the only answer that got me a working dataset from my postgres database in PowerBI. – Dan Aug 11 '22 at 15:58