Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the March 2024 Fabric update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
7 | |
4 | |
4 |