Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I cannot overwrite table schema using spark.write.mode("overwrite")
For example, create a table with 2 column: col1 as int and col2 as string
Then change col1 to data type int and use spark.write.mode("overwrite")
It return error
Solved! Go to Solution.
I think if you want to overwrite the schema while overwriting the data, you could write like this:
df\
.write\
.mode("overwrite")\
.option("overwriteSchema", "true")\
.saveAsTable("tableName")
So I think you only need to add .option("overwriteSchema", "true") in your code
I think if you want to overwrite the schema while overwriting the data, you could write like this:
df\
.write\
.mode("overwrite")\
.option("overwriteSchema", "true")\
.saveAsTable("tableName")
So I think you only need to add .option("overwriteSchema", "true") in your code
I tried and successed. Thank you very much.