Delta Table - Partitioning

Anand4
New Contributor II

Created a streaming job with delta table as a target.  The table did not have a partition when created earlier, however i would like to add an existing column as a partition column.

I am getting the following error.

com.databricks.sql.transaction.tahoe.DeltaAnalysisException: [_LEGACY_ERROR_TEMP_DELTA_0007] Partition columns do not match the partition columns of the table.

Is re-writing the entire table with the partition column the only way forward ?

Alberto_Umana
Databricks Employee
Databricks Employee

Hi @Anand4,
Delta Lake does not support altering the partitioning of an existing table directly. Therefore, the way forward is to rewrite the entire table with the new partition column

View solution in original post