Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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.
User | Count |
---|---|
23 | |
10 | |
6 | |
2 | |
1 |
User | Count |
---|---|
32 | |
23 | |
11 | |
7 | |
7 |