Connect Digital Ocean PostgreSQL to Power BI

Utilizing ODBC in Power BI, this tutorial discusses how to sync data to Power BI from a PostgreSQL database hosted externally.

Figuring out how to integrate a Digital Ocean PostgreSQL database with Power BI was difficult to say the least. If you’re currently going through similar issues, we’ve outlined a step by step process below to walk you through how to do this.

Note: This uses the ODBC connector in Power BI which, as of this article, does not support Power Query, only import mode. This means you will have to refresh data to get up to date reports or set up scheduled refreshes.

Get connection parameters from Digital Ocean.

First, get the database details from your Digital Ocean database. This is under the “Connection Parameters“ in your Digital Ocean account and should look like this:

host=app-******************************.db.ondigitalocean.com 
port=<port number>
username=<username>
password=<password>
database=<db name>
sslmode=require

If you’re having issues finding this, check out this article from Digital Ocean: https://docs.digitalocean.com/products/databases/postgresql/how-to/connect/#connection-details

Connect to Power BI using ODBC

Now that we have our connection params, we can use the ODBC connector to connect the database to Power BI. First, you will need to be on your Windows Machine, with Power BI downloaded and opened.

Next, you’ll need to download the PostgreSQL ODBC driver from this link:

Scroll to the bottom of the page and download the version that matches your Window’s x86 or x64 spec.

Next, you’re going to want to open and install the driver.

From here, you may want to restart Power BI, and potentially your computer.

Now, open Power BI Desktop, open a report or create a new Blank Report and select “Get Data“ from the toolbar.

Next, from the pop up, search “odbc“ and the ODBC option should pop up.

Select ODBC, the data source should be (None) and press ok. A drop down asking for a connection string should come up and, using your database’s parameters, you can create the following string (I used ChatGPT to assist):

 Driver={PostgreSQL Unicode(x64)};Server=app-****************.db.ondigitalocean.com;Port=<port number>;Database=<db name>;sslmode=require;

From there just press ok, and you should be connected!

If you have further questions please reach out to [email protected].