nayan_wylde
Esteemed Contributor II

This error stems from the Iceberg table metadata update constraints enforced by the Unity Catalog's REST API. Specifically, the Iceberg REST Catalog currently does not support multiple schema changes in a single commit. Each ALTER TABLE operation that modifies the schema (e.g., adding columns) triggers a SetCurrentSchema update, and the system restricts this to one per commit.

To avoid this error:

  • Add columns one at a time using separate ALTER TABLE statements.
  • If automating schema evolution, ensure your logic batches column additions sequentially.
columns_comments = {
    "col1": "comment1",
    "col2": "comment2",
    ....
    "col236": "comment236",
}

for col, comment in columns_comments.items():
    spark.sql(f"ALTER TABLE table_name CHANGE COLUMN {col} SET COMMENT '{comment}'")

Consider raising a support ticket or feature request with Databricks if this limitation impacts your workflow significantly.

View solution in original post