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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
sergei
Frequent Visitor

REST API: change PostgreSQL datasource database

Is there a way to use the REST API to change the PostgreSQL datasource, specifically, change its database and server address?

 

Here is what I am doing:

  • I create a report in Power BI desktop, which imports data from a PostgreSQL datasource through an on-premised gateway. 
  • I upload the pbix report to the Power BI cloud service using the REST API (for use in Power BI Embedded).
  • I now need to switch the database from a staging DB to the production DB

The Update Datasources In Group API documentation says that it can only be used with "SQL Server, Azure SQL Server, Analysis Services, Azure Analysis Services, OData Feed, and SharePoint datasources. For other datasource types, use Update Parameters In Group".

 

The aforementioned Update Parameters In Group API requires that "All parameters must exist in the dataset." However, my dataset does not have any parameters, as far as I can tell, so I get errors when I try to set any parameters:

 

error.png

 

I can see the connection details using the Get Datasources In Group API (screenshot below). Is there any way to change them?

 

datasource.PNG

 

 

 

1 ACCEPTED SOLUTION
sergei
Frequent Visitor

I figured out an answer to my own question, and want to share it with anyone else who gets stuck on this. 

 

The Update Parameters In Group API call is the right approach. However, the dataset needs to be set up in advance to hold the database and server address in parameters, which can then be modified using the API. 

 

To set up the data source with parameters, click Edit Queries within Power BI Desktop. There is an Edit Parameters option there. Create parameters with your connection info. Then, under Edit Queries > Data source settings, Change the data source to use these parameters instead of explicitly specifying the connection strings. Here is a screenshot:

 

 

params.PNG

Hope this helps!

View solution in original post

1 REPLY 1
sergei
Frequent Visitor

I figured out an answer to my own question, and want to share it with anyone else who gets stuck on this. 

 

The Update Parameters In Group API call is the right approach. However, the dataset needs to be set up in advance to hold the database and server address in parameters, which can then be modified using the API. 

 

To set up the data source with parameters, click Edit Queries within Power BI Desktop. There is an Edit Parameters option there. Create parameters with your connection info. Then, under Edit Queries > Data source settings, Change the data source to use these parameters instead of explicitly specifying the connection strings. Here is a screenshot:

 

 

params.PNG

Hope this helps!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.