Forum Discussion

julsr's avatar
julsr
Icon for Continued Contributor rankContinued Contributor
8 months ago
Solved

Update schema of large semantic models

Hi everyone,   I have a large semantic model (40M+ rows) with incremental refresh enabled. Currently, any schema change (e.g., renaming a column or adding something new) requires opening the full m...
  • v-dineshya's avatar
    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