Power BI connects to AnalyticDB for PostgreSQL through the built-in PostgreSQL database connector, letting you load data, build visualizations, and publish reports.
Prerequisites
Before you begin, ensure that you have:
A Power BI client downloaded and installed. See Microsoft Power BI
An AnalyticDB for PostgreSQL instance with a privileged account. See Create an instance and Create a database account
A public endpoint for the instance. See Manage public endpoints
The IP address of the device where the Power BI client is installed added to the instance's IP address whitelist. See Configure an IP address whitelist
A table with data in the instance. This guide uses the
customertable withageandlogin_timecolumns as an example
Connect Power BI to AnalyticDB for PostgreSQL
Open the Power BI client.
In the top navigation bar, click Home. Choose Get data > More.
In the Get Data dialog box, choose Database > PostgreSQL database, then click Connect.
In the PostgreSQL database dialog box, enter the connection details and click OK.
Parameter Description Server The public endpoint and port number of the instance. Example: gp-bp152460513z****o-master.gpdb.rds.aliyuncs.com:5432Database The name of the AnalyticDB for PostgreSQL database Data Connection mode How Power BI retrieves data. See Choose a data connection mode In the credentials dialog box, enter the database account username and password, then click Connect.
ImportantIf the Encryption Support dialog box appears, click OK.
Parameter Description User name The database account used to connect to the instance Password The password of the database account In the Navigator dialog box, select the
customertable and click Load.In the Visualizations pane of the Report View tab, select a chart type. This example uses Clustered Column Chart.
In the Fields pane, select the columns to display. This example uses
ageandlogin_time.Click the
icon in the upper-left corner to save the report.(Optional) Click Publish in the upper-right corner of the Home page to publish the report to the Power BI service.
NoteSign in to the Power BI service if prompted.
Choose a data connection mode
Power BI offers two modes for connecting to AnalyticDB for PostgreSQL:
| Mode | How it works | When to use |
|---|---|---|
| Import | Copies data into Power BI | The data source contains a smaller amount of data |
| DirectQuery | Queries the database in real time | Large datasets; near-real-time data requirements |
Troubleshooting
Connection fails at step 4
Check the following:
The Server field contains the correct public endpoint and port in the format
<endpoint>:<port>The IP address of the device where the Power BI client is installed is in the instance's IP address whitelist
After confirming both, retry the connection.