apache-sparkjdb

Prevent spark jdbc write from changing the table structure


I am using spark df write to write to oracle table -

When the data is written the underlying oracle table structure is changed by spark

df.write.
                  mode(SaveMode.Overwrite).
                  jdbc(targetJdbcUrl, targetTable, targetProps)

Is there a way to prevent spark from modifying the table structure?

For example -

source_desc varchar(200)

get converted to

source_desc varchar(255)

Solution

  •  mode(SaveMode.Append)
    

    Did the trick.