Databricks Dataframe: Merge exception for string column in delta table with change detectio enabled.

crami
New Contributor III

Hi,

I am trying to append change data records into delta table using dataframe. However, I am encountering an issue while appending new records to existing data in delta table. The exception raised is
Cannot merge columns 'ColumnX' into 'ColumnX'
Both new dataframe column datatype and delta table column datatype is string.
Is there any way to avoid this issue ?
Code Line:

df_result.write.format("delta").mode("append").option("delta.enableChangeDataFeed", "true").saveAsTable(table_target)
Attached script code.