cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Py4JJavaError when trying to write dataframe to delta table

AK98
New Contributor II

I'm trying to write a dataframe to a delta table and am getting this error.

image.pngIm not sure what the issue is as I had no problem successfully writing other dataframes to delta tables. I attached a snippet of the data as well along with the schema:

imageimage

3 REPLIES 3

Rishabh-Pandey
Esteemed Contributor

hey @Ashad Khan​ refer this link https://bigdataprogrammers.com/write-dataframe-to-delta-table-in-databricks-with-overwrite-mode/

that might help you ,

Rishabh Pandey

ramravi
Contributor II

Does your delta tables contains all columns what your dataframe contains. If there is schema mismatch it might be a reason for failure.

df.write.format("delta") \
           .option("mergeSchema", "true") \
           .mode("append") \
           .save(DELTALAKE_SILVER_PATH)

AK98
New Contributor II

My understanding was that I was writing to a brand new delta table that doesn't exist, and hence there would be no schema mismatch. I also tried the inferSchema option. Is that not the case? I did the same for other dataframes and it wasn't an issue

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group