Forum Discussion

jaryszek's avatar
jaryszek
Super User
10 months ago

How to update field names using XMLA for all visuals without power query?

Hello,

I am using Direct Lake over OneLake - how to rename columns using XMLA without power query possibilities which is disabled in Direct Lake mode? 

It is possible or fileds should be renamed only upstream? 

Best,
Jacek

9 Replies

      • v-dineshya's avatar
        v-dineshya
        Community Support

        Hi jaryszek ,

        Thank you for reaching out to the Microsoft Community Forum.

         

        Yes, it is possible to rename columns in Direct Lake mode using XMLA.

         

        1.  Use Tabular Editor 3 (Enterprise Edition) to rename columns via XMLA, but ensure you first rename them in the web interface to prevent reversion during schema sync.

         

        2. Rename columns upstream in the Lakehouse or Warehouse before adding them to the semantic model.

         

        Please refer below link.

        Power BI usage scenarios: Advanced data model management - Power BI | Microsoft Learn

         

        I hope this information helps. Please do let us know if you have any further queries.

         

        Regards,

        Dinesh

    • v-dineshya's avatar
      v-dineshya
      Community Support

      Hi jaryszek ,

      You can use the Fabric notebooks by using the PySpark code to change the column names of a table in Lakehouse. Please refer below PySpark code. to rename the column names.

       

      spark.read.table("tableName")\
      .withColumnRenamed("oldColumnName", "newColumnName")\
      .write\
      .mode("overwrite")\
      .option("overwriteSchema", "true")\
      .saveAsTable("tableName")

       

      Please refer below example.

       

      1. I have created sample data in Lakehouse.

       

       

      2. Created a Notebook, and run the below sample PySpark code to rename the column names.

       

       

      It will change the column names and save the Notebook. And then refresh the table in Lakehouse, it will reflect the changes.

       

      I hope this information helps. Please do let us know if you have any further queries.

       

      Regards,

      Dinesh

       

       

       

      • jaryszek's avatar
        jaryszek
        Super User

        thanks, let's do not close topic, maybe somebody will propsoe another tool also.

        Best,
        Jacek