Datasets - Update Datasources
Updates the data sources of the specified dataset from My workspace.
Note
We recommend using enhanced dataset metadata with this API call.
Important
- The original data source and the new data source must have the exact same schema.
- If you're using enhanced dataset metadata, refresh the dataset to get data from the new data sources.
- If you're not using enhanced dataset metadata, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.
Permissions
The user must be the dataset owner.
Limitations
- Datasets created using the public XMLA endpoint aren't supported. To make changes to those data sources, the admin must use the Azure Analysis Services client library for Tabular Object Model.
- Only these data sources are supported: SQL Server, Azure SQL Server, Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and SAP HANA. For other data sources, use the Update Parameters API call.
- Changing the data source type isn't supported.
- Data sources that contain parameters in the connection string aren't supported.
- Updating data sources that are part of merged or joined tables is only supported if you're using enhanced dataset metadata.
- For an Advanced Query that references multiple data sources, only the first data source will be updated. To overcome this limitation, define the data source as a parameter and use the Update Parameters API call.
Required Scope
Dataset.ReadWrite.All
POST https://api.powerbi.com/v1.0/myorg/datasets/{datasetId}/Default.UpdateDatasources
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
dataset
|
path | True |
|
The dataset ID |
Request Body
Name | Required | Type | Description |
---|---|---|---|
updateDetails | True |
An array of data source connection update requests |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK |
Examples
Example
Sample Request
POST https://api.powerbi.com/v1.0/myorg/datasets/cfafbeb1-8037-4d0c-896e-a46fb27ff229/Default.UpdateDatasources
{
"updateDetails": [
{
"datasourceSelector": {
"datasourceType": "Sql",
"connectionDetails": {
"server": "My-Sql-Server",
"database": "My-Sql-Database"
}
},
"connectionDetails": {
"server": "New-Sql-Server",
"database": "New-Sql-Database"
}
},
{
"datasourceSelector": {
"datasourceType": "OData",
"connectionDetails": {
"url": "http://services.odata.org/V4/Northwind/Northwind.svc"
}
},
"connectionDetails": {
"url": "http://services.odata.org/V4/Odata/Northwind.svc"
}
}
]
}
Sample Response
Definitions
Datasource |
A Power BI data source |
Datasource |
The Power BI data source connection details |
Update |
|
Update |
Required scopeDataset.ReadWrite.All
|
Datasource
A Power BI data source
Name | Type | Description |
---|---|---|
connectionDetails |
The data source connection details |
|
connectionString |
|
(Deprecated) The data source connection string. Available only for DirectQuery. |
datasourceId |
|
The bound data source ID, which is empty when not bound to a gateway |
datasourceType |
|
The data source type |
gatewayId |
|
The bound gateway ID, which is empty when not bound to a gateway. When using a gateway cluster, the gateway ID refers to the primary (first) gateway in the cluster and is similar to the gateway cluster ID. |
name |
|
(Deprecated) The data source name. Available only for DirectQuery. |
DatasourceConnectionDetails
The Power BI data source connection details
Name | Type | Description |
---|---|---|
database |
|
The connection database |
server |
|
The connection server |
url |
|
The connection URL |
UpdateDatasourceConnectionRequest
Name | Type | Description |
---|---|---|
connectionDetails |
The target connection details of the updated data source |
|
datasourceSelector |
The connection details of the data source that needs update. This is mandatory when a dataset has more than one data source. |
UpdateDatasourcesRequest
Required scope
Dataset.ReadWrite.All
Name | Type | Description |
---|---|---|
updateDetails |
An array of data source connection update requests |