Skip to content

Brainstorm Python interface for ALTER TABLE #110

@MrPowers

Description

@MrPowers

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())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions