Forum Discussion
Update schema of large semantic models
- 8 months ago
Hi julsr ,
Thank you for reaching out to the Microsoft Community Forum.
By using SSMS + TMSL you can update a Power BI semantic model without opening Power BI Desktop. It works ONLY if your workspace is on a Premium / Fabric F/SK capacity because it requires XMLA read/write.
Please try below steps.
1. In Power BI Service, Open your workspace --> Go to Settings --> Premium / Fabric capacity. Copy the XMLA endpoint URL:
powerbi://api.powerbi.com/v1.0/myorg/SalesWorkspace
2. In SSMS, Open SQL Server Management Studio --> Click Connect --> Analysis Services. Enter the XMLA endpoint URL.
3. Authentication, Azure Active Directory - Universal (with MFA). Sign in with your Power BI account. After connecting, you will see all datasets as “databases”.
4. Right-click the Dataset --> New Query --> XMLA. This opens a query window where you can run TMSL(Tabular Model Scripting Language) scripts. Execute through an XMLA connection.
To Rename a Column refer below JSON code.
{
"alter": {
"object": {
"database": "ModelName",
"table": "FactSales",
"column": "OldColumnName"
},
"renameTo": "NewColumnName"
}
}To Add a New Column refer below JSON code.
{
"alter": {
"object": { "database": "ModelName" },
"script": "{
\"tables\": [{
\"name\": \"FactSales\",
\"columns\": [{
\"name\": \"NewCol\",
\"dataType\": \"string\"
}]
}]
}"
}
}Please refer below link.
Tabular Model Scripting Language (TMSL) Reference | Microsoft Learn
I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh
Hi julsr ,
Thank you for reaching out to the Microsoft Community Forum.
By using SSMS + TMSL you can update a Power BI semantic model without opening Power BI Desktop. It works ONLY if your workspace is on a Premium / Fabric F/SK capacity because it requires XMLA read/write.
Please try below steps.
1. In Power BI Service, Open your workspace --> Go to Settings --> Premium / Fabric capacity. Copy the XMLA endpoint URL:
powerbi://api.powerbi.com/v1.0/myorg/SalesWorkspace
2. In SSMS, Open SQL Server Management Studio --> Click Connect --> Analysis Services. Enter the XMLA endpoint URL.
3. Authentication, Azure Active Directory - Universal (with MFA). Sign in with your Power BI account. After connecting, you will see all datasets as “databases”.
4. Right-click the Dataset --> New Query --> XMLA. This opens a query window where you can run TMSL(Tabular Model Scripting Language) scripts. Execute through an XMLA connection.
To Rename a Column refer below JSON code.
{
"alter": {
"object": {
"database": "ModelName",
"table": "FactSales",
"column": "OldColumnName"
},
"renameTo": "NewColumnName"
}
}
To Add a New Column refer below JSON code.
{
"alter": {
"object": { "database": "ModelName" },
"script": "{
\"tables\": [{
\"name\": \"FactSales\",
\"columns\": [{
\"name\": \"NewCol\",
\"dataType\": \"string\"
}]
}]
}"
}
}
Please refer below link.
Tabular Model Scripting Language (TMSL) Reference | Microsoft Learn
I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh
- v-dineshya8 months ago
Community Support
Hi julsr ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.
Regards,
Dinesh
- v-dineshya8 months ago
Community Support
Hi @julsr ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.
Regards,
Dinesh