Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I have been trying to alter a table in fabric warehouse to add a column but seems like there is a limitation to it. So I have been trying to implement this notebook by adding a column to the delta tables and save/orvewrite the existing file. I have used the below code to do so:
import os, requests
DATA_ROOT = "/lakehouse/default"
DATA_FOLDER = "Files/Test/dbo"
df_Dummy = spark.read.format('delta').option('header',True).option('inferSchema',True).load(f'{DATA_FOLDER}/Dummy/')
spark.conf.set("spark.databricks.delta.schema.autoMerge.enabled",'true')
addingcol = df_Dummy.withColumn('DummyName', lit('Company'))
addingcol.write.format('delta').option('mergeSchema','true').mode('overwrite').save("Files/Test/dbo/Dummy")
addingcol.show()
But it has been throwing the following error:
What am I doing wrong here? Is it even possible to overwrite the exisiting table in delta format to add a column so it reflects in warehouse? The idea is to alter the table in warehouse to add a new column ultimately.
Please do suggest any other way if anybody knows.
Hi @swathisudheer ,
As of now 6th Feb 2024 , ALTER TABLE command is not supported for tables in Lakehouse and Warehouse. So when you try to modify the table using Spark code it might result in some issues.
Please follow any of the two approaches listed below to alter column.
Kr,
Maddy
Hi @swathisudheer ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet .
In case if you have any resolution please do share that same with the community as it can be helpful to others .
Otherwise, will respond back with the more details and we will try to help .
Hello @swathisudheer ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet .
In case if you have any resolution please do share that same with the community as it can be helpful to others .
If you have any question relating to the current thread, please do let us know and we will try out best to help you.
In case if you have any other question on a different issue, we request you to open a new thread .
Hi @v-gchenna-msft ,
The solutions that @Madhusudan_P suggested involve deletion of the table as a step and I am looking for a solution where I could avoid that. I still have not found a solution for this. Waiting for Microsoft to fix this or get a better work aorund to alter the table to add column.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Data Engineering, Data Science, Data Warehouse and General Discussion.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 |