Skip to content

DROP BRANCH

Remove a branch from a Lance table.

Spark Extension Required

This feature requires the Lance Spark SQL extension to be enabled. See Spark SQL Extensions for configuration details.

Overview

The DROP BRANCH command deletes a named branch reference from a Lance table. This removes the branch metadata entry, but does not rewrite data on main or on any other existing branch.

Syntax

ALTER TABLE <table> DROP BRANCH [IF EXISTS] <branch_name>;

Example

ALTER TABLE lance.db.users DROP BRANCH IF EXISTS feature_x;

Output

The DROP BRANCH command returns:

Column Type Description
name String The name of the dropped branch

Notes and Limitations

  • DROP BRANCH is implemented as a Spark SQL extension command.
  • The target table must be a Lance table.
  • IF EXISTS can be used when dropping a branch conditionally.
  • Use SHOW BRANCHES to inspect existing branches before deleting one.

See Also