ALTER TABLE is currently only exposed via the SQL interface.
It'd be nice to run ALTER TABLE with Python code.
Take a look at the code from this blog post for example:
ALTER TABLE delta.`/tmp/delta-table/` ADD COLUMNS (blah string)
There is already this syntax for creating a Delta table:
deltaTable = (DeltaTable.create(sparkSession)
.tableName("testTable")
.addColumn("c1", dataType = "INT", nullable = False)
.addColumn("c2", dataType = IntegerType(), generatedAlwaysAs = "c1 + 1")
.partitionedBy("c1")
.execute())
Perhaps we could use this syntax for altering a Delta table:
(mack.alter(delta_table)
.addColumn("blah", dataType = "string", nullable = False)
.execute())
ALTER TABLE is currently only exposed via the SQL interface.
It'd be nice to run ALTER TABLE with Python code.
Take a look at the code from this blog post for example:
There is already this syntax for creating a Delta table:
Perhaps we could use this syntax for altering a Delta table: