Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered
I managed to add new columns to an existing table using
df.limit(0).write.format("delta").mode("append").option("mergeSchema", "true").save(tablename)
however when columns are removed , this method does not actually drop columns in the delta table. I think I read that it doesnt actually remove the column, but will set the value to null?
however when I then run the merge, it fails with
AnalysisException: Cannot resolve <removed column> in UPDATE clause given columns .....
delta_table.alias("target").merge(
source=df.alias("source"),
condition="target.accessnum = source.accessnum",
).whenMatchedUpdateAll().whenNotMatchedInsertAll().execute()
so this seems to me that it doesnt know that the source column has been removed.
I have the configuration set with
spark.conf.set("spark.sql.parquet.vorder.enabled", "true")
spark.conf.set("spark.microsoft.delta.optimizeWrite.enabled", "true")
spark.conf.set("spark.microsoft.delta.optimizeWrite.binSize", "1073741824")
spark.conf.set("spark.microsoft.delta.schema.autoMerge.enabled", "true")
#config to enable all new Delta tables with Change Data Feed
spark.conf.set("spark.microsoft.delta.properties.defaults.enableChangeDataFeed", "true")
so what do I have to do to handle columns being removed from the source when updating and inserting?
Thanks
The source has removed the column, and I am doing a merge and update all the delta table. However updateall is trying to update the column that no longer exists in the source.
It beginning to sound like I will have to specify the columns and can't just use updateall.
Hi @jonjoseph ,
Is this helpful - MERGE on delta table with source structure change - Microsoft Community Hub
It is also having a discussion on this point too -
Hello @jonjoseph ,
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 more details and we will try to help .
Hello @jonjoseph ,
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 @jonjoseph ,
Thanks for using Fabric Community.
As I understand you are trying to insert a column into the target table that does not exist in the source table.
I haven't tried it, but you can refer this - MERGE on delta table with source structure change - Microsoft Community Hub
Incase if my understanding is wrong, can you please share few more details so that I can guide you better.
Hope this is helpful. Please let me know incase of further queries.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Fabric update to learn about new features.
User | Count |
---|---|
9 | |
5 | |
4 | |
3 | |
3 |